![]() However, SQL doesn’t care about uppercase or lowercase. The convention is to write all the keywords in uppercase and everything relating to table such as column name in lowercase. - is used to end the statement in SQL, which means the query ends here.Īs other programming languages have their conventions, SQL also has its own conventions.- () are used to enclose the column names and datatypes.- age INT: age is column name and INT is simply the integer.- email VARCHAR(255): email is the column name, VARCHAR is the datatype which is text and emails could be long so 255 is the character limit.First name is not going to be very big so it’s a good idea to optimize with the character limit. first_name VARCHAR(40): first_name is the column name in the table and VARCHAR is the data type which simply is text and 40 is the character limit.id SERIAL PRIMARY KEY: id is the column name, SERIAL is a special type which increments integer value with +1 each time a new data entry takes place, PRIMARY KEY makes id column a unique identifier which is used to reference to specific rows.Note: In SQL, every uppercase is a syntax keyword, lowercase is not the keyword and its name can be the choice of programmer. CREATE TABLE workers: CREATE TABLE is the keyword which creates the table and workers is the table name. ![]() Now, let’s discuss the table creation syntax step by step: ![]() Let's jump directly into it and create a table so that you can understand: CREATE TABLE workers( To create a table in PostgreSQL, you have to use a specific syntax consisting of specific keywords responsible for table creation. In databases, a table is like a container that stores the data in the forms of columns and rows, much like excel or google sheets. Let's learn to create tables in PostgreSQL and how to perform basic operations, such as insert or create, read, update, and delete, on tables.
0 Comments
Leave a Reply. |