0% found this document useful (0 votes)
9 views35 pages

EMRS, PGT Class 16, SQL

A relational database (RDBMS) organizes data into tables (relations) with rows (tuples) and columns (attributes), where each row represents a unique data instance. SQL (Structured Query Language) is the standard language used for managing and retrieving data in relational databases, with various dialects like T-SQL and PL/SQL. The document also outlines basic SQL commands and provides a brief history of SQL's development and standardization.

Uploaded by

Jyothi S
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)
9 views35 pages

EMRS, PGT Class 16, SQL

A relational database (RDBMS) organizes data into tables (relations) with rows (tuples) and columns (attributes), where each row represents a unique data instance. SQL (Structured Query Language) is the standard language used for managing and retrieving data in relational databases, with various dialects like T-SQL and PL/SQL. The document also outlines basic SQL commands and provides a brief history of SQL's development and standardization.

Uploaded by

Jyothi S
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/ 35

PGT- COMPUTER SCIENCE

RELATIONAL DATABASE (RDBMS)

➢ A relational database is a (most commonly digital) database


based on the relational model of data, as proposed by E. F.
Codd at IBM in 1970.

➢ It is used to organize collection of data as a collection of


relations where each relation corresponds to a table of
values.

➢ Each row in the table corresponds to a unique instance of


data and each column name is used to interpret the
meaning of that data in each row.
RELATIONAL DATABASE (RDBMS)
➢ For example, consider EMPLOYEE table in Figure

➢ Each row in this table represents facts about a particular


employee.
IN RELATIONAL MODEL,
➢ A row is called a Tuple.

➢ A column is called an Attribute.

➢ A table is called as a Relation.

➢ The data type of values in each column is called the Domain.

➢ The number of attributes in a relation is called the Degree of a


relation.

➢ The number of rows in a relation is called the Cardinality of a


relation.
IN RELATIONAL MODEL,

➢ Relation Schema R is denoted by R (A1 , A2 , A3 …, An ) where R is


the relation name and A1 , A2 , A3 …, An is the list of attributes.

➢ Relation State is the set of tuples in the relation at a point in time. A


relation state r of relation schema R (A1 , A2 , A3 …, An ), denoted
r(R) is a set of n-tuples r = {t1, t2,...., tm}, where each n-tuple is an
ordered list of values t = <v1, v2, ...,vn>, where vi is in domain of A
or is NULL. Here n is the degree of the relation and m is the
cardinality of I the relation.
MORE CHARACTERISTICS OF RELATIONS
➢ Ordering of tuples is not important in a Relation.

➢ The ordering of attributes is also unimportant.

➢ No two tuples of relation should be identical i.e. given any pair of two
tuples, value in at least one column must be different.

➢ The value in each tuple is an atomic value (indivisible).

➢ If the value of an attribute in a tuple is not known or not applicable


or not available, a special value called null is used to represent them
RELATIONAL MODEL CONSTRAINTS

➢ Constraints, are restrictions on the values, stored in a


database based on the requirements.

➢ For example, in the relation EMPLOYEE, the


Employee_ID must be a 4-digit number, the Date_of_Birth
must be such that the birth year > 1985.
RELATIONAL MODEL CONSTRAINTS
SQL

➢ SQL is a database computer language designed for


the retrieval and management of data in a relational
databases like MySQL, MS Access, SQL Server, MS
Access, Oracle, Sybase, Informix, Postgres etc.

➢ SQL stands for Structured Query Language.

➢ SQL was developed in the 1970s by IBM Computer


Scientists.
SQL

➢ SQL is not a database management system, but it is


a query language which is used to store and
retrieve the data from a database or in simple
words SQL is a language that communicates with
databases.

➢ SQL was developed in the 1970s by IBM Computer


Scientists and became a standard of the American National
Standards Institute (ANSI) in 1986, and the International
Organization for Standardization (ISO) in 1987.
SQL

➢ Though SQL is an ANSI (American National


Standards Institute) standard language, but there
are many different dialects of the SQL language
like MS SQL Server is using T-SQL and Oracle is
using PL/SQL.
BRIEF HISTORY OF SQL
➢ 1970 − Dr. Edgar F. "Ted" Codd of IBM is known as the father of
relational databases. He described a relational model for
databases.

➢ 1974 − Structured Query Language (SQL) appeared.

➢ 1978 − IBM worked to develop Codd's ideas and released a


product named System/R.

➢ 1986 − IBM developed the first prototype of relational database


and standardized by ANSI. The first relational database was
released by Relational Software which later came to be known as
Oracle.

➢ 1987 − SQL became the part of the International Organization for


Standardization (ISO).
SQL

➢ Though SQL is an ANSI (American National


Standards Institute) standard language, but there
are many different dialects of the SQL language
like MS SQL Server is using T-SQL and Oracle is
using PL/SQL.
SQL
SQL
SQL BASIC COMMANDS

➢ The standard SQL commands to interact with relational


databases are CREATE, SELECT, INSERT, UPDATE,
DELETE and DROP.
SQL BASIC COMMANDS
SQL BASIC COMMANDS
SQL BASIC COMMANDS
SQL BASIC COMMANDS
TCL (Transaction Control Language) :

Transaction Control Language commands are used to


manage transactions in the database. These are used
to manage the changes made by DML-statements.
SQL BASIC COMMANDS
SQL BASIC COMMANDS
Q. Which SQL function is used to count the number of
rows in a SQL query?

a) COUNT()
b) NUMBER()
c) SUM()
d) COUNT(*)
Q. Which of the following is not a valid SQL type?

A. FLOAT
B. NUMERIC
C. DECIMAL
D. CHARACTER
Q. Which of the following is not a DDL command?

A. TRUNCATE
B. ALTER
C. CREATE
D. UPDATE
Q. Which statement is used to delete all rows in a table
without having the action logged?

A. DELETE
B. REMOVE
C. DROP
D. TRUNCATE
Q. Which of the following are TCL commands?

a) UPDATE and TRUNCATE


b) SELECT and INSERT
c) GRANT and REVOKE
d) ROLLBACK and SAVEPOINT
Q. ________________ is not a category of SQL command.

a) TCL
b) SCL
c) DCL
d) DDL
Q. Which of the following statement is true?

a) DELETE does not free the space containing the table


and TRUNCATE free the space containing the table
b) Both DELETE and TRUNCATE free the space
containing the table
c) Both DELETE and TRUNCATE does not free the
space containing the table
d) DELETE free the space containing the table and
TRUNCATE does not free the space containing the table
Get the PDF of this lecture
on telegram.
Target Abhi Mobile App

@teachersaddabytargetabhi

You might also like