SQL — Creating Table ( basic level )

MURAT GUNGOR
2 min readApr 4, 2023

--

Tables are where data lives and its relationships are defined. When you create a table, you assign a name to each column (some-times referred to as a field or attribute) and assign it a data type. These are the values the column will accept — such as text, integers, decimals and dates — and the definition of the data type is one way SQL enforces the integrity of data. For example, a column defined as date will take data in one of several standard formats, such as YYYY-MM-DD. If you try to enter characters not in a date format, you’ll receive an error.

See data types below;

Data stored in a table can be accessed and analyzed, or queried, with
SQL statements. You can sort, edit, and view the data, and easily change the
table later if your needs change.

Let’s make a table;

CREATE TABLE employees(
id int,
first_name varchar(25),
last_name varchar(50), company_name varchar(50),
hire_date date,
salary numeric  );
  • The reason we put numbers in brackets is to adjust the length of the text.

I will be posting more on SQL Tips in the coming days.

--

--

MURAT GUNGOR
MURAT GUNGOR

No responses yet