capypad
0 day streak
sql / beginner
Snippet

Creating a Table

The CREATE TABLE statement is used to create a new table in a database. You must define the name of the columns and their data types.

snippet.sql
sql
1
2
3
4
CREATE TABLE users (
id INTEGER,
username VARCHAR(50)
);
Breakdown
1
id INTEGER,
Defines a column named 'id' that stores whole numbers.
2
username VARCHAR(50)
Defines a column named 'username' that stores text up to 50 characters.