April 2024
Intermediate to advanced
127 pages
2h 29m
English
In the previous chapter, we learned to create and use a database. In this chapter, we’ll learn to add tables to our database. We’ll also learn to alter and delete the tables if necessary. This is a relatively long chapter, so take your time to slowly go through it.
First, let’s look at how we can create tables to add to our database. To create a table, we use the following syntax:
CREATE TABLE table_name ( column_name1 datatype [column constraints], column_name2 datatype [column constraints], … [table constraints], [table constraints]);
Let’s discuss the syntax in detail.
Tables in SQL databases are organized in rows and columns. Suppose we want to create a ...