top of page
Writer's picturePriya Gajbhiye

SQL : Create table and Insert data

Hello Friends, this is my very first blog.

SQL (Structured Query Language)

SQL is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS). It is particularly useful in handling structured data.

When you need to store data in relational databases, first step is to create a database. Next step is to create a table which will hold your relational data. SQL consists many sublanguages, commonly:

a data query language (DQL),


a data definition language (DDL),


a data control language (DCL),


and a data manipulation language (DML)


Here, I am explaining how to CREATE Table, Insert values in table, Check values from table and how to add primary key to the column.

Int datatype is used to store numeric field and varchar is used to store a string of letters, digits, symbols of varying length. In this example varchar length is 20 it means i can store maximum 20 characters in this column.

Sometimes it is essential to mandatorily specify values in column we achieve this by using not null constraint. in this example employee id is not null.




In this below screenshot I inserted values in all columns in employee and department table. To check column values from employee table and department table use syntax (select * from employee) and (select * from department). This will give you all the column values in both the tables.




In the below screenshot, I added primary key constraint on emp_id from employee table and dept_id from department table. Primary key is the attribute which can be used to uniquely identify a record.










96 views

Recent Posts

See All
bottom of page