Creating tables is actually quite simple. However before we go creating tables we need to first understand the data we want to store. To make sure our data scales appropriately we need to break down the data into its smallest form so we can easily add data and read from it.
https://dev.mysql.com/doc/refman/8.0/en/data-types.html https://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm https://docs.microsoft.com/en-us/sql/t-sql/data-types/data-types-transact-sql?view=sql-server-2017 https://www.postgresql.org/docs/9.5/datatype.html
Instructor: [00:00] Let's create a table with SQL. Here, we're going to be using the create statement. We'll say create table users, and then in open parentheses, we'll say create date. There's going to be a date. User handle is going to be a UUID. Last name will be a text. First name will be a text as well.
[00:19] We'll close it off and then use a semicolon. Perfect. We've created our first table. The main principle to keep in mind here is the create statement. This tells your database that we'll be creating something new.
[00:30] We'll use the create statement to add other components within our database. For this instance, we need to define what we're creating, which is a table. After we've established we're creating a table, we'll give it a name, users.
[00:43] Inside the parentheses, we'll define all of the columns within our new table and list the type of data that will live within this column. For example, the create date column holds date types of data. Each time data is inserted into this table, the data will need to match each data type or an error will be thrown.
[01:02] Text is referring to a string or a character type, and UUID is a universally unique identifier. Some other recognized types used in SQL are Boolean and for numbers. Each database such as Postgres and MySQL will have more granular and advanced types that can be used.
[01:19] I will link to some popular databases that use SQL below in the video notes. I recommend taking some time to go through these because they can vary greatly between databases.