0% found this document useful (0 votes)
47 views20 pages

UNit1 - Database Languages

This document discusses database languages. It describes database languages as languages and interfaces used to query and update database data. There are four main types of database languages: data definition language (DDL) used to define the database schema, data manipulation language (DML) used to insert, update and retrieve data, data control language (DCL) used to control access to data, and transaction control language (TCL) used to manage transactions. Examples are provided of SQL commands for each type of language like CREATE, ALTER, DROP for DDL and INSERT, UPDATE, DELETE, SELECT for DML.

Uploaded by

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

UNit1 - Database Languages

This document discusses database languages. It describes database languages as languages and interfaces used to query and update database data. There are four main types of database languages: data definition language (DDL) used to define the database schema, data manipulation language (DML) used to insert, update and retrieve data, data control language (DCL) used to control access to data, and transaction control language (TCL) used to manage transactions. Examples are provided of SQL commands for each type of language like CREATE, ALTER, DROP for DDL and INSERT, UPDATE, DELETE, SELECT for DML.

Uploaded by

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

Unit-1

Topic:

Database Languages
Learning Objectives

At the end of this session, you will be able to:

• What is database languages?

• Types of database languages

• Uses of database languages


Learning Objectives

At the end of this session, you will be able to:

• What is database languages?

• Types of database languages

• Uses of database languages


Definition:

• What is database languages?

A DBMS has appropriate languages and interface to express

database queries and updates.

Database languages can be used to read, store and update

the data in the database.


Database Languages:

DBMS has 4 types of languages:


1)Data Definition Language(DDL).
2)Data Manipulation Language(DML).
3)Data Control language (DCL).
4) Transaction control language (TCL).
Database Languages:
1) Data Definition Language(DDL):
- Database language that is used to create, delete or modify database schema is ca
DDL.
- It is used by Database Administrators (DBA) to specify the conceptual schema
-DDL interpreter converts DDL statements into equivalent low level statements
understood by the DBMS.
-Normally create, alter, and drop statements are DDL statements DDL statement
make changes in the schema.
Database Languages:
Ex: For create command
create table student
(
sid number(4),
sname varchar2s(50),
DOB varchar2(15)
);
The above create command will creates the new table student with sid,
Sname and DOB as table fields.
Database Languages:
Example: For alter command:-
Alter table Student ADD COLUMN address varchar(20);
The above command will add the column name called, address to
the existing student table with the maximum length of 20 characters.
Example: For drop command
drop Student;
The above command will delete the table student from database.
Database Languages cont.…
2) DATA MANIPULATION LANGUAGE(DML):
Database language that enables insert, update, delete, and retrieval of
data from the database is called Data Manipulation Language.

DML complier converts DML statements into equivalent low level


statements that the database understands.

Normally, insert, update, delete, select are DML commands. DML reflects
Database Languages cont.…
Ex: For insert command:
insert into student values("A-101", "Ramesh", 12);
Ex: for update command:
update student set class = 11 where sid = "A-101“;
Ex: For delete command:
delete from student where sname = "RAJ“ ;
Ex: for select command:
select * from student ;
3) Data Control language (DCL):
DCL statements control access to data and the database using
statements such as GRANT and REVOKE. A privilege can either be
granted to a User with the help of GRANT statement.
The privileges assigned can be SELECT, ALTER, DELETE,
EXECUTE, INSERT, INDEX etc. In addition to granting of privileges,
you can also revoke (taken back) it by using REVOKE command.
3) (DCL – grant and revoke ):
GRANT :
-This command is used to allow a permission for specific user.

DENY:
- This command is used to refuse the permission for particular user.

REVOKE:
- The revoke command is used to remove a GRANT or DENY
privileges from a specific user or role, or from all users, to perform actions on
database objects.
3) DCL – grant:
Grant Command:
• Give the permission to other user.
Syntax
Grant <privileges> on <tablename> to
<username>
Example
SQL>Grant select on emp to user1;
3) DCL – grant:

Example:

SQL> Grant select, insert on emp to user2;

SQL> Grant update (addr) on emp to user3;

SQL> grant update (salary, addr) on emp to user4;

SQL> Grant select (sno=10) on emp to user5;


3) DCL – revoke
Revoke Command is used to cancel the permission for a particular user.
Syntax:
revoke <privileges> on <tablename> from <username>

Example:
SQL>revoke select on emp from user1;
SQL> revoke insert, delete on emp from user2;
Syntax:
Deny <privileges> to <username>

SQL> DENY CREATE TABLE, CREATE PROCEDURE TO user1;


SQL is case insensitive:
Note :

*In SQL, cases are insensitive. So, instead of Student one


can write StUdEnT as well.

* Also, for integer values "12" is incorrect but 12 is


correct.

And, for char and varchar "course" is correct and course


is incorrect.
Summary

In this session, you have learned about:

 What is database languages?

 Types of database languages

 Examples of sql queries


MCQ 1

The DBMS provides interfaces and __________ for querying and


updating the database.

1.Languages
2.Inferences
3.Texts
4.Lines

Answer: A) Languages
MCQ 2

Database languages can be used to ___________________ the data


in the database.

1.Read
2.Store
3.Update
4.All of the above

Answer: D) All of the above


MCQ 3

What is the full form of DDL?

1.Data Distinct Language


2.Data Different Language
3.Data Dominant Language
4.Data Definition Language

Answer: D) Data Definition Language

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy