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

SQL

Uploaded by

aminabibihere
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

SQL

Uploaded by

aminabibihere
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL

Structured Query Language is a standard Database language that


is used to create, maintain, and retrieve the relational database.
SQL is case insensitive. But it is a recommended practice to use
keywords (like SELECT, UPDATE, CREATE, etc.) in capital letters and
use user-defined things (like table name, column name, etc.) in
small letters.
We can write comments in SQL using “–” (double hyphen) at the
beginning of any line. SQL is the programming language for
relational databases.

What is Relational Database?


A relational database means the data is stored as well as retrieved
in the form of relations (tables).

STUDENT Table
ROLL_N ADDRES AG
O NAME S PHONE E

945512345
1 RAM DELHI 18
1

RAMES 965243154
2 GURGAON 18
H 3

915625313
3 SUJIT ROHTAK 20
1

915676897
4 SURESH DELHI 18
1

Important Terminologies
These are some important terminologies that are used in terms of
relation.
 Attribute: Attributes are the properties that define a
relation. e.g., ROLL_NO, NAME etc.
 Tuple: Each row in the relation is known as tuple. The
above relation contains 4 tuples.
 Degree: The number of attributes in the relation is known
as degree of the relation. The STUDENT relation defined
above has degree 5.
 Cardinality: number of tuples in a relation is known as
cardinality. The STUDENT relation defined above has
cardinality 4.
 Column: Column represents the set of values for a
particular attribute.
Division of SQL Commands:
SQL commands can be divided into two main sub-languages.
1-Data Definition Language (DDL)
2-Data Manipulation Language (DML)

Data Definition Language (DDL)


Data Definition Language (DDL) contains the commands used to create and
destroy databases and database objects.
Data Manipulation Language (DML)
Data Manipulation Language to insert, retrieve and modify information from
database.

Exact Numeric Datatype


There are nine subtypes which are given below in the table. The
table contains the range of data in a particular type.
Data Type From To

-263 (- 263 -1
BigInt 9,223,372,036,854,775,8 (9,223,372,036,854,775,8
08) 07)

Int -231 (-2,147,483,648) 231-1 (2,147,483,647)

smallint -215 (-32,768) 215-1 (32,767)

tinyint 0 28-1 (255)

bit 0 1

decimal -1038+1 1038-1

numeric -1038+1 1038-1

-
922,337,203,685,477.580
money 922,337,203,685,477.580
7
8
Data Type From To

smallmoney -214,748.3648 214,748.3647

You might also like