From the course: Relational Databases Essential Training
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Solution: Create tables with DDL commands
From the course: Relational Databases Essential Training
Solution: Create tables with DDL commands
(uptempo music) - [Instructor] For this code challenge, we were asked to create a table for storing information about our movie watching activities so that we can remember what movies we've seen and our thoughts about each film. Now, the table diagram that was developed included the details for a number of different columns, so we just need to translate that into the SQL code to add it into our database. And we start that by using a CREATE TABLE statement. The name of the table is MovieNight, and after that I open up a parentheses. I'm going to move the closing parentheses down to the end. I like to make sure that I don't forget it and I'll just place it down here at the very end on line 7 just to get it out of the way. And now we can just start filling in the individual columns that were identified in the diagram. So the first column was MovieID. That is going to store an integer data type, and it was also specified to be the primary key for the table. I'm also going to specify that…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Convert the ER diagram to a database7m
-
(Locked)
Data definition queries6m 22s
-
(Locked)
Solution: Create tables with DDL commands6m 2s
-
(Locked)
Data manipulation queries4m 52s
-
(Locked)
Solution: Add data with DML commands5m 30s
-
(Locked)
Write database select queries5m 38s
-
(Locked)
Solution: Query data in a database4m 26s
-
(Locked)
Create a database view2m 44s
-
(Locked)
-
-