forked from TMBCchallenge/challenge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.sql
27 lines (23 loc) · 901 Bytes
/
db.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
Application requires threaded commenting system. There will be an author and comments belong to the author.
Please write create statements for tables accordingly and write query to be run on application that will return :
- All the comments sorted by created date
- Replies to those comments
- first_name of the author for each comment
- Created date of every comment
Keep in mind the best performance.
You can add/edit columns to the tables or create additional tables if necessary.
Consider adding foreign key constraints, indices etc.
*/
/* AUTHOR TABLE */
CREATE TABLE `author` (
`id`,
`comment` varchar(2000)
) ENGINE=InnoDB AUTO_INCREMENT=2046711 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
/* COMMENT TABLE */
CREATE TABLE `comment` (
`id`,
`first_name` varchar(20)
) ENGINE=InnoDB AUTO_INCREMENT=2046711 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
/* QUERY */
SELECT * FROM comments;