1 00:00:00,150 --> 00:00:01,790 Before you start writing queries, 2 00:00:01,790 --> 00:00:06,480 it's usually a good idea to spend a little time getting acquainted with the database. 3 00:00:06,480 --> 00:00:11,172 So lets take a minute and see what tables we'll be using, and how they fit together. 4 00:00:11,172 --> 00:00:14,210 The database at Jefferson Middle School contains seven tables. 5 00:00:14,210 --> 00:00:17,370 The first table you'll need to know about is the STUDENTS table. 6 00:00:17,370 --> 00:00:20,129 Which contains an ID primary key, and then the first and 7 00:00:20,129 --> 00:00:24,140 last names of the student, followed by the student's grade. 8 00:00:24,140 --> 00:00:28,200 Next is the TEACHERS table, which contains an ID primary key and 9 00:00:28,200 --> 00:00:30,060 then the teacher's first and last names. 10 00:00:31,220 --> 00:00:33,560 After that, we've got the SUBJECTS table, 11 00:00:33,560 --> 00:00:37,000 which contains the different subjects, like math and science. 12 00:00:37,000 --> 00:00:39,200 This table contains an ID primary key, 13 00:00:39,200 --> 00:00:43,180 followed by the subject's name, what grade the subject is intended for, and 14 00:00:43,180 --> 00:00:46,420 then a quick description of what that subject teaches. 15 00:00:46,420 --> 00:00:51,640 There's also a ROOMS table, which contains one row for each room in the school. 16 00:00:51,640 --> 00:00:55,000 In here, there's an ID primary key, as well as an integer 17 00:00:55,000 --> 00:00:57,770 identifying the maximum number of students the room can hold. 18 00:00:57,770 --> 00:01:02,580 A school day at Jefferson Middle School is made up of 7 periods, 19 00:01:02,580 --> 00:01:04,750 summarized in the PERIODS table. 20 00:01:04,750 --> 00:01:09,330 It's got an ID primary key, followed by the start time and duration of the period. 21 00:01:09,330 --> 00:01:14,010 Also, the ID of each period represents which period it is. 22 00:01:14,010 --> 00:01:17,870 So the period with an ID of one is going to represent the first period of the day. 23 00:01:19,210 --> 00:01:23,240 Getting to something a bit more complicated, we've got the CLASSES table. 24 00:01:23,240 --> 00:01:27,747 Each row in the CLASSES table represents one individual class. 25 00:01:27,747 --> 00:01:32,570 So for each class, we've got an ID primary key followed by four foreign keys. 26 00:01:32,570 --> 00:01:36,203 Telling us which subject is being taught, which period it is, 27 00:01:36,203 --> 00:01:39,230 which teacher teaches it, and which room it's in. 28 00:01:40,410 --> 00:01:44,600 Finally, we've got the SCHEDULE table, which contains scheduling information for 29 00:01:44,600 --> 00:01:46,230 all of the students. 30 00:01:46,230 --> 00:01:49,780 Each row is a pairing between a student and a class. 31 00:01:49,780 --> 00:01:51,880 So, if we've scheduled everything correctly, 32 00:01:51,880 --> 00:01:54,850 that means each student should have seven rows in this table. 33 00:01:56,200 --> 00:02:00,040 All right, now that you know a bit more about how their database is structured, 34 00:02:00,040 --> 00:02:02,130 lets get you warmed up with a few practice problems.