Id Name Age: Celebs
Id Name Age: Celebs
Id Name Age: Celebs
Query Results
id name age
1 Justin Bieber 22
2 Beyonce Knowles 33
3 Jeremy Lin 26
4 Taylor Swift 26
Database Schema
celebs
name type
id INTEGER
name TEXT
age INTEGER
Rows: 4
Relational Databases
Nice work! In one line of code, you returned information from a relational database.
A table is a collection of data organized into rows and columns. Tables are
sometimes referred to as relations. Here the table is celebs.
An id of 1
A name of Justin Bieber
An age of 22
All data stored in a relational database is of a certain data type. Some of the most
common data types are:
Statements
The code below is a SQL statement. A statement is text that the database recognizes
semicolon ;.
CREATE TABLE table_name (
column_1 data_type,
column_2 data_type,
column_3 data_type
);
Let’s break down the components of a statement:
2. table_name refers to the name of the table that the command is applied to.
The structure of SQL statements vary. The number of lines used does not matter. A
statement can be written all on one line, or split up across multiple lines if it makes it
easier to read. In this course, you will become familiar with the structure of common
statements.
id is the first column in the table. It stores values of data type INTEGER
name is the second column in the table. It stores values of data type TEXT
age is the third column in the table. It stores values of data type INTEGER