Challenge: Changing the Books Structure
Your manager has decided that the books_table
table should have an auto-incrementing book_id
to uniquely identify each book. Additionally, the book_id
will be set as the primary key for the table.
Swipe to start coding
You are tasked with recreating the books_table
table with the following columns:
book_id
- The unique id of the book (SERIAL
),PRIMARY KEY
;title
- The title of the book (VARCHAR
, max-length255
),NOT NULL
;author
- The author of the book (VARCHAR
, max-length100
);genre
- The genre/category of the book (VARCHAR
, max-length50
);published_year
- The year the book was published (INTEGER
);isbn
- The International Standard Book Number (VARCHAR
, max-length20
);publisher
- The publisher of the book (VARCHAR
of max-length100
);pages
- The number of pages in the book (INTEGER
);language
- The language of the book (VARCHAR
of max-length50
);is_available
- Whether the book is available for lending (BOOLEAN
);
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Summarize this chapter
Explain the code in file
Explain why file doesn't solve the task
Awesome!
Completion rate improved to 1.72
Challenge: Changing the Books Structure
Swipe to show menu
Your manager has decided that the books_table
table should have an auto-incrementing book_id
to uniquely identify each book. Additionally, the book_id
will be set as the primary key for the table.
Swipe to start coding
You are tasked with recreating the books_table
table with the following columns:
book_id
- The unique id of the book (SERIAL
),PRIMARY KEY
;title
- The title of the book (VARCHAR
, max-length255
),NOT NULL
;author
- The author of the book (VARCHAR
, max-length100
);genre
- The genre/category of the book (VARCHAR
, max-length50
);published_year
- The year the book was published (INTEGER
);isbn
- The International Standard Book Number (VARCHAR
, max-length20
);publisher
- The publisher of the book (VARCHAR
of max-length100
);pages
- The number of pages in the book (INTEGER
);language
- The language of the book (VARCHAR
of max-length50
);is_available
- Whether the book is available for lending (BOOLEAN
);
Solution
Thanks for your feedback!
Awesome!
Completion rate improved to 1.72single