Database
In this course, we'll work with multiple tables: songs, singers, and albums. They are connected to each other, and this is shown in the schema:
Each record in these tables has an id, and these ids are presented in other tables. For example, singer Britney Spears has an id = 2, so the song 'Sometimes' has a column singer_id with value 2 in it.
It's much more comfortable to use id values instead of raw values to avoid mistakes and keep it consistent. You can see the content of each table below:
songs
albums
singers
We can see that NULL fields appeared. We may also notice that some albums and singers' records are not using in the songs table, but we still keep it.
Records' ids have values starting with 1, but these values can be not integers, but strings, or fixed-bitness numbers (from 10000 to 99999, for example), etc. and some numbers can be missed.
Note that there are repeated names for columns in different tables (for example,
idis present in all tables). To select some columns from a specific table, we have to refer to the column with the table's name: for example,songs.idinstead ofid. It is more clear to specify the column name with a table name to understand what data we work with. But if the column's name is unique among all columns, we can refer column by its name only, and it will still be correct.
Swipe to start coding
Remember how to retrieve the data from the table: return all records from the songs table.
Solution
During the course, you'll complete a lot of tasks, and for some attempts to send a query you may receive the Internal Server Error as an output. Most likely, it means that the result of your query is empty (there is no matching record, or the database is empty, for example). Try to change the query so the result is non-empty, and send it again.
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 5.88
Database
Swipe to show menu
In this course, we'll work with multiple tables: songs, singers, and albums. They are connected to each other, and this is shown in the schema:
Each record in these tables has an id, and these ids are presented in other tables. For example, singer Britney Spears has an id = 2, so the song 'Sometimes' has a column singer_id with value 2 in it.
It's much more comfortable to use id values instead of raw values to avoid mistakes and keep it consistent. You can see the content of each table below:
songs
albums
singers
We can see that NULL fields appeared. We may also notice that some albums and singers' records are not using in the songs table, but we still keep it.
Records' ids have values starting with 1, but these values can be not integers, but strings, or fixed-bitness numbers (from 10000 to 99999, for example), etc. and some numbers can be missed.
Note that there are repeated names for columns in different tables (for example,
idis present in all tables). To select some columns from a specific table, we have to refer to the column with the table's name: for example,songs.idinstead ofid. It is more clear to specify the column name with a table name to understand what data we work with. But if the column's name is unique among all columns, we can refer column by its name only, and it will still be correct.
Swipe to start coding
Remember how to retrieve the data from the table: return all records from the songs table.
Solution
During the course, you'll complete a lot of tasks, and for some attempts to send a query you may receive the Internal Server Error as an output. Most likely, it means that the result of your query is empty (there is no matching record, or the database is empty, for example). Try to change the query so the result is non-empty, and send it again.
Thanks for your feedback!
single