0% found this document useful (0 votes)
10 views

dbms06 SQL Part 1 18

JjKz anjana kamakaj akanksha KzkkKz sjsmsmms zkskkskse kmskks akanksha skskskks sksmmsms dkkdmsms

Uploaded by

SANDEEP Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

dbms06 SQL Part 1 18

JjKz anjana kamakaj akanksha KzkkKz sjsmsmms zkskkskse kmskks akanksha skskskks sksmmsms dkkdmsms

Uploaded by

SANDEEP Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

www.gradeup.

co

1
www.gradeup.co

Content :-
1. SQL Meaning
2. Basic Terminology
3. Classification of SQL Statements
4. Data Type
5. Commands
a. Create
b. Insert
c. Describe

SQL : It is the standard language for storing ,retrieving and manipulating in database. SQL
stands for Structure Query Language.
Some Basic Terminology
Tuple : A row of a relation is generally referred to as a tuple .
Attribute : A column of a relation is generally referred to as a attribute.
Degree : This refers to the number of attributes in a relation
Cardinality :- This refers to the number of tuples in a relation
Primary Key :- It is a set of one or more attributes that can uniquely identify the tuple in a
relation .

DDL Commands: DDL stands for Data Definition Language, this commands allow you to
perform tasks related to data definition. Following commands include in it:

S.No. Command & Description


1 CREATE
Create a new table, a view of table, or other object in the database
2 ALTER
Modify an database object, i.e. table
3 DROP
Deletes an entire table, a view of table or other objects in the database

DML Commands: DML stands for Data Manipulation Language, this command allow you to
perform data manipulation. Following commands include in it:
S.No Command & Description
1 SELECT
Retrieves the records from one or more tables
2 INSERT

2
www.gradeup.co

Creates a records
3 UDATE
Modifies the record
4 DELETE
Delete the records
DCL Commands: DCL stands for Data Control Language, this allows you to manage and
control the data. Following commands includes:
S.No. Command and Description
1 GRANT
Gives privilege to user
2 REVOKE
Take back privileges granted from user

Data Types:-Data types are means to identify the type of data and associated operations for
handling it. Some of the most commonly data type used in SQL are stated below :
Data Type Spec
CHAR String(0-255)
VARCHAR String(0-255)
INT Integer(-2147483648 to 2147483648)
FLOAT Decimal(precise to 23 digits
DECIMAL “DOUBLE” stored as string
DATE YYYY-MM-DD
DATETIME YYYY-MM-DDHH:MM:SS
BOOLEAN TINYINT(1)

Difference Between Char and Varchar: -The difference between the char and varchar is that
of fixed length and variable length.

CREATE TABLE :This command is used to create the table , naming of columns are done ,
data type are set .
Syntax :-

CREATE TABLE <table-name>


(<column name><data type> [(size)],
<Column name><data type>[(size)….]);

To Create an employee table whose schema is as follows:


employee(ecode,ename,sex,grade,gross)

the SQL command will be


CREATE TABLE employee (ecodeinteger ,ename char(20),sex char(1), grade char(2), gross
decimal) ;

INSERTING TABLE INTO TABLE: The rows(tuples) are added to relations using INSERT
Command of SQL . IN its simplest form , INSERT takes the following syntax :
INSERT INTO<tablename>[<column list>] VALUES(<value>,<value>…..);

for example , to enter a row into employee table(defined earlier) , you could use
the following statement :

3
www.gradeup.co

INSERT INTO employee VALUES(1001,’Ravi’,’M’,’E4’,4670.00);

Viewing of Table Structure :-


DESC[RIBE] <tablename> ;

For example:-
DESC Empl;
Or DESCRIBE Empl;

4
www.gradeup.co

You might also like