This guide is an overview to the basics of the SQL `CREATE TABLE` functions.
We will be using MySQL for all examples throughout these freeCodeCamp SQL guides. MySQL is a used frequently on websites for the backend database, 2) it's free, and is fun and easy to use.
## Covered in this Guide
* Creating a schema, the container for all our database objects.
* Create a table so we have something to alter.
* Creating a table by importing a CSV file and altering that table
* Creating a table using the MySQL workbench tool
We do most of this work with SQL statements in the MySQL workbench scripting tool. We will also see how to Create a table using the workbench interface instead of with SQL statements.
## High level structure of a Relational Database
1. Highest level; The Database; the database system installation. In this case, it’s MySQL. Called “Local instance MySQL Router” in the screen shots above.
2. Next is a Schema; a container for the objects needed to managed data in a relational database system.
3. Objects we create (tables, indexes, stored procedures, functions) to manage the system and its data
## Creating a table, add test data with "insert", rename the table (alter)
We’ll create a Student Table.
The steps will be:
1. make sure we don’t have the table already
2. create the table
3. insert the test data.
* Data Types: the student name is a character field limited to 90 characters
* The student ID is a number (integer) (range of -2147483648 to 2147483647). This will be the primary key for the table and will auto increment when a record is added.
* There will also be two "time-stamp" fields to play with as well
Create statement and display of results from execution;
The first time stamp is the creation data and time and the 2nd is the update date and time. Changing a record should update ts2 but not ts1. Let's take a look.