Introduction Mysql, DDL, DML and Keys
Introduction Mysql, DDL, DML and Keys
10 Language (SQL)
10.1 INTRODUCTION
PaVANd
facebook 0g
Sign Up
IRs free and always will be.
In the previous chapter, you have learnt about database concepts related to SQL. This chapter
deals exclusively with relational databases, its tables and retrieving the data using Structured
Query Language (SQL.).
neSE
multiple
rows at a time. These features
make SQL a very
powerful language as
edit other languages where one command can
process a single record at a time.
compared
rovides aa high
high l.level of well-defined set of commands that provides desirable
Reliable:SsQL provides
any ambiguity.
results
with
cdata abstraction: SQL provides a greater degree of freedom of abstraction
Freedon
also be used to create, insert, delete and control access to data in databases.
i tcan
10.5
CLASSIFICATION OF SQL STATEMENTS
nguage that is used
that is us to interact with the database. The SQL statements or commands
language
is a
are the
statement that are regarded as instructions to the database.
thatwe type
erent
SQL provides differe types of statements or commands for different purposes. These
statements
are classified into the !following categories:
sQL Statements
Commands
0.5.1 Data Definition Language (DDL) sQL
database tables
The DDL part of SQL permits
defines indices
to be created or deleted. It also
DML
links between tables and imposes
DDL
(keys), specifies
tables. It contains necessary
constraints on INSERT
DROP CREATE
statements for creating, manipulating,
altering and
ALTER UPDATE
deleting the table.
DELETE
Examples of DDL commands in SQL are:
DATABASE-creates a new
database. Fig.10.3: Most Commonly-used SQL Commands
CREATE
an already existing database.
USE command-to select and open
KEY
DESCRIPTION
Primary Key A primary key an attribute or a group of attributes that can
is
uniquely identify tuples within the relation.
Candidate Key A candidate key is one that is
capable of becoming the primary key
(i.e., candidate for primary key
position).
Alternate Key A candidate key that is not the
primary key is called an alternate key
Foreign Key A non-key attribute whose
value(s) are derived from the primary key
of some other table is known
as foreign key in its current table.
Let us discuss these kevs in detail