Introducing SQL
Structured Query Language (SQL and often pronounced "sequ-el") provides a common language for querying and manipulating data in relational databases. While there are a few differences, SQL mostly works the same in relational database systems such as Oracle, SQL Server, MySQL, and H2.
The first thing you need to do is to create a table. To do so, use the CREATE TABLE
SQL command. To create a table, you must provide the name of the table, the names and types of the columns, and any constraints.
Exercise 2: Creating the customer Table
Use the SQL CREATE TABLE
command to create a customer
table. It should contain the customer ID and the users' first and last names.
- Enter the following SQL commands in the upper-right input pane:
CREATE TABLE IF NOT EXISTS customer ( CUSTOMER_ID long, USERNAME varchar(255), FIRST_NAME varchar(255), LAST_NAME varchar(255), UNIQUE(USERNAME), PRIMARY KEY (CUSTOMER_ID) );
- After entering the SQL command, click...