The table courses
below consists of columns id
, name
and abbreviatedName
with id
as PRIMARY KEY
.
Write a set of statements to:
- create a new table
books
with the following columns, data types and constraints.
column | data type | constraint |
---|
id | INTEGER | PRIMARY KEY |
name | TEXT | NOT NULL |
courseId | INTEGER | FOREIGN KEY on id in courses |
- add these record rows to the created table
books
, in the given order.
id (INTEGER) | name (TEXT) | courseId (INTEGER) |
---|
1 | Basics of Ruby | 4 |
2 | Basics of SQL | 7 |