![]() We will discuss this in more detail in the next section.Īfter the types we see the constraints. Some types require additional arguments, which is why you will sometimes see parenthesis after the type with some values in it. We always declare the table name first, and then with each row we define a a field, or a column in the spreadsheet metaphor, and then we declare what type this field will be, followed by any constraints we have on the field. When we create an SQL table we will be using code that follows the format:ĬREATE TABLE table_name ( field_name TYPE CONSTRAINTS, field_name TYPE ( args ) CONSTRAINTS ) There are many things that technically make spreadsheets and SQL tables different, but the big ones we want to focus on are types and constraints. When we want to add a new user to a table we would add a row to the table that stores all of the information that our table defines. When we want to add new users to our spreadsheet we would simply add another row to the spreadsheet and fill in a value for each of the columns.Ī table in a PostgreSQL database works very similarly. ![]() When we define an SQL table we are creating a new spreadsheet and filling in the headers for each of the columns we are going to use.įor example, if we wanted to create a spreadsheet to store a list of users, we might start out with something like this: SQL tables are a little easier to understand if you think of them like creating a spreadsheet. ![]() Now lets go ahead and start creating a few tables to play with. We have created and connected to the calhounio_demo database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |