SQL CREATE TABLE AND INSERT INTO TABLE STATEMENTS | DBMS - Anna University Multiple Choice Questions

SQL CREATE TABLE AND INSERT INTO TABLE STATEMENTS | DBMS

How to create a table in Data Base using sql queries or statements

The create Table statements are used to create tables in the database

Syntax for creating table in database

SQL > CREATE TABLE SYNTAX


create table table-name(column_name 1 data_type, column_name 2 data_type, column_name 3 data_type);


Example for Table Creation in Database using sql statements


SQL > CREATE TABLE EXAMPLE


create table person(name varchar(10), address varchar(10),age int);


Thus the table named as person is created.In the below section we are going to see "How to insert data's into the table "using sql statements.




How to Insert data's into the table in Data Base using sql statements or comments


The Insert into Table sql statements are used to insert data's in the tables which is in the database.


Syntax for inserting data's in the created tables.


SQL > INSERT INTO STATEMENT SYNTAX


insert into table-name values(value int,value int,'value char');


Example for inserting data's in the created tables.


SQL > INSERT INTO STATEMENT EXAMPLE


insert into person values('Eshin','marthandam',20);
insert into person values('Jozer','nagercoil',20);

Thus the data's are inserted in the table named person.




Note:

char data-types must be enclosed by single quotes.
int  data-types must be inserted without any quotes.


2 comments: