SQL - SPLessons

SQL Create Table

Chapter 8

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

SQL Create Table

SQL Create Table

shape Description

SQL Create table articulation is utilized to make a table in the database server. And each table in the database should contain unique name and these tables are organised into rows and columns, where appropriate data or values should be inserted. And the column parameters specifies the name of the columns of the table and the datatypes parameters specifies the type of data that the column is holding that may vary from varchar, decimal, date and integers. 

shape Conceptual
figure

shape Syntax

Syntax for SQL Create table:
Create table <table_name>(<Column_name1>data_type(size),<Column_name2>data_type(size),<Column_name3> data_type(size));

Table name => Any accurate table in the database.

Column name =>The operation that can be performed on a  column in the table.

shape Examples

The below example describes the creation of a table in the database.

sql> Create table employee(emp_id int,ename varchar(255),job varchar(255),salary int);
Query OK, 0 rows affected (0.64 sec)

sql> create table department(dept_id int,dname varchar(255),commission int)
Query ok, 0 rows affected (0.64 sec)

In the above example, the table employee has been successfully created by specifying the datatypes and size.And in another example a table department has been successfully created by specifying the datatypes and size.

Summary

shape Key Points

  • SQL Create table – Is utilized to make a table in the SQL Database by indicating the datatype and size.