Skip to content

Analyzing CREATE TABLE

Daniel Cortes edited this page Jul 29, 2024 · 3 revisions

Lets understand the syntax of what is going on here.

This SQL statement consists of different words, some words are what we refer to as keywords, others are identifiers.

Keywords are very special words inside of SQL that tell the database that we want to do a very specific thing or designate some particular option. Identifiers tell a database what we want to somehow operate on. So CREATE TABLE is an example of a keyword and cities is an example of an identifier. Keywords will always be capitalized and identifiers will always be lowercased.

Out of this entire SQL statement, each line has a specific purposes to create this table:

Inside the parenthesis we list out the columns that the table contains and right after it we list out the type of data stored inside that column. Such as data of type VARCHAR(50) or INTEGER, these are column data types. An INTEGER is a number without a decimal. So from -2,147,482,647 to +2,147,482,647. Anything larger or smaller = error!

Clone this wiki locally