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

Department Name Computer Application

The document discusses the topics that will be covered in Unit 1 of a Database Management Systems course. It includes an overview of DDL commands like CREATE, ALTER, DROP and TRUNCATE used to define and modify database schema. It also covers DML commands like SELECT, INSERT, UPDATE and DELETE used to manage the data. The document provides examples of each command and discusses transaction control statements. It outlines the learning outcomes and key terms that students should understand after completing the unit.

Uploaded by

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

Department Name Computer Application

The document discusses the topics that will be covered in Unit 1 of a Database Management Systems course. It includes an overview of DDL commands like CREATE, ALTER, DROP and TRUNCATE used to define and modify database schema. It also covers DML commands like SELECT, INSERT, UPDATE and DELETE used to manage the data. The document provides examples of each command and discusses transaction control statements. It outlines the learning outcomes and key terms that students should understand after completing the unit.

Uploaded by

kundan
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Institute Name Computer Application

Department Name Computer Application


Program: MCA
Branch:
Semester/Year: I
Subject Name: DBMS
Subject Code: CAPDCDBM018P

Faculty Name: Sakshi Dubey


Designation: AP
Department: Computer Application
Unit No
Unit 1
1. Minor project to design a database.
2. Hands on DDL, DML statements.
3. Write SQL queries using aggregate functions, group by
having clause.
4. Write SQL queries using string comparison functions and
order by clause.
5. Write SQL queries using sub query and correlated sub
query.
6. Write SQL queries using joins.
Faculty Name sakshi Dubey Unit 1 3
Topic and structure of lesson
 Business Intelligence Introduction

Cycle of Business Intelligence

Faculty Name Unit 1 4


Learning Outcome
Knowledge of basic concepts, components & applications
of database systems as well as Entity-Relationship model.
Learn basics of SQL and use of commercial relational database
system (Oracle) by writing Queries using SQL.
 Use the design principles for logical design of databases,
including the E‐R method and normalization approach.
Applying relational algebra expressions for queries.
 Knowledge of basic issues of transaction processing and
concurrency control & basic database storage structures
and access techniques.

Faculty Name sakshi dubey Unit 1 5


Key Terms you must be able to use

If you have mastered this topic, you should be able to


use the following terms correctly in your assignments
and exams:

 Sample: Data Communications Module

 Sample: Analog Signals

 Sample: Digital Signals


Faculty Name Unit 1 6
Last lecture summary and
recapitulation

DDL

Faculty Name Sakshi dubey Unit 1 7


DDL command
CREATE
ALTER
DROP
TRUNCATE

# Structure will be as per the nomenclature of the program and will be finalized in
consultation with Head of Dept/Head of Institution.
Faculty Name Sakshi dubey Unit 1 8
CREATE command
  It is used to create a new table in the database.
 CREATE TABLE TABLE_NAME (COLUMN_NAME DATATYPES[,....]);  

Example:
 CREATE TABLE EMPLOYEE(Name VARCHAR2(20), Email VARCHAR2(100), DOB 
DATE);  

# Structure will be as per the nomenclature of the program and will be finalized in
consultation with Head of Dept/Head of Institution.
Faculty Name Sakshi dubey Unit 1 9
DROP command
 It is used to delete both the structure and record stored in the table.
 Syntax
DROP TABLE ;  
Example
 DROP TABLE EMPLOYEE;  

# Structure will be as per the nomenclature of the program and will be finalized in
consultation with Head of Dept/Head of Institution.
Faculty Name Sakshi dubey Unit 1 10
ALTER Command
 It is used to alter the structure of the database. This change could be either
to modify the characteristics of an existing attribute or probably to add a new
attribute.
 Syntax:
 To add a new column in the table
 ALTER TABLE table name ADD column_name COLUMN-definition;    
 To modify existing column in the table:
 ALTER TABLE MODIFY(COLUMN DEFINITION....);  
 EXAMPLE
 ALTER TABLE STU_DETAILS ADD(ADDRESS VARCHAR2(20));  
 ALTER TABLE STU_DETAILS MODIFY (NAME VARCHAR2(20));  

# Structure will be as per the nomenclature of the program and will be finalized in
consultation with Head of Dept/Head of Institution.
Faculty Name Sakshi dubey Unit 1 11
TRUNCATE command
 TRUNCATE: It is used to delete all the rows from the table and free the space
containing the table.
 Syntax:
 TRUNCATE TABLE table_name;  
 Example:
 TRUNCATE TABLE EMPLOYEE;  

# Structure will be as per the nomenclature of the program and will be finalized in
consultation with Head of Dept/Head of Institution.
Faculty Name Sakshi dubey Unit 1 12
DML command
Command Description
Used to query or fetch selected fields or columns from a database
SELECT
table
INSERT Used to insert new data records or rows in the database table
Used to set the value of a field or column for a particular record to
UPDATE
a new value
DELETE Used to remove one or more rows from the database table

# Structure will be as per the nomenclature of the program and will be finalized in
consultation with Head of Dept/Head of Institution.
Faculty Name Sakshi dubey Unit 1 13
select
 SELECT command or statement in SQL is used to fetch data records from the database
table and present it in the form of a result set. It is usually considered as a DQL
command but it can also be considered as DML.
 The basic syntax for writing a SELECT query in SQL is as follows :
SELECT column_name1, column_name2, … FROM table_name WHERE condition_
expression;
 The parameters used in the above syntax are as follows :
 column_name1, column_name2, … : Specify the column_names which have to be
fetched or selected for the final result set.
 table_name: Specify the name of the database table from which these results have
to be fetched.
 condition_expression: Specify the condition expression for filtering records for the
final result set.
 Here are a few examples to illustrate the use of SELECT command.

SELECT customer_id, sale_date, order_id, store_state FROM customers;

# Structure will be as per the nomenclature of the program and will be finalized in
consultation with Head of Dept/Head of Institution.
Faculty Name Sakshi dubey Unit 1 14
INSERT
INSERT commands in SQL are used to insert data records or rows in a database
table. In an INSERT statement, we specify both the column_names for which the
entry has to be made along with the data value that has to be inserted.

The basic syntax for writing INSERT statements in SQL is as follows :

INSERT INTO table_name (column_name_1, column_name_2, column_name_3, ...)


VALUES (value1, value2, value3, ...)

INSERT INTO public.customers(customer_id, sale_date, sale_amount, salesperson,


store_state, order_id) VALUES (1005,'2019-12-12',4200,'R K Rakesh','MH','1007');

# Structure will be as per the nomenclature of the program and will be finalized in
consultation with Head of Dept/Head of Institution.
Faculty Name Sakshi dubey Unit 1 15
UPDATE
UPDATE command or statement is used to modify the value of an existing column
in a database table.
The syntax for writing an UPDATE statement is as follows :
UPDATE table_name SET column_name_1 = value1, column_name_2 = value2, ...
WHERE condition;

example based on the UPDATE statement in SQL.


UPDATE customers SET store_state = 'DL‘ WHERE store_state = 'NY';

# Structure will be as per the nomenclature of the program and will be


finalized in consultation with Head of Dept/Head of Institution.

Faculty Name Sakshi dubey Unit 1 16


DELETE
 DELETE statement in SQL is used to remove one or more rows from the database
table. It does not delete the data records permanently. We can always perform a
rollback operation to undo a DELETE command. With DELETE statements we can
use the WHERE clause for filtering specific rows.
 The syntax for writing an DELETE statement is as follows :

 DELETE FROM table_name WHERE condition;


 example based on the DELETE command in SQL.
DELETE FROM customers WHERE store_state = 'MH‘ AND customer_id = '1001';

# Structure will be as per the nomenclature of the program and will be finalized in
consultation with Head of Dept/Head of Institution.
Faculty Name Unit 1 17
TCL (transaction Control Language)

TCL (transaction Control Language): TCL commands deals with


the transaction within the database.

Examples of TCL commands:


 COMMIT– commits a Transaction.
 ROLLBACK– rollbacks a transaction in case of any error occurs.
 SAVEPOINT–sets a save point within a transaction.
SET TRANSACTION–specify characteristics for the transaction.

# Structure will be as per the nomenclature of the program and will be


finalized in consultation with Head of Dept/Head of Institution.

Faculty Name sakshi dubey Unit 1 18


Cont..
 The Structure of Create Table Command
 Table name is Student
Coulmn Nmae Data type size
Reg no Varchar 2 10
name char 30
Dob date

 Example: CREATE TABLE Student


              (Reg_no varchar2(10),
               Name char(30),
               DOB date,

# Structure will be as per the nomenclature of the program and will be


finalized in consultation with Head of Dept/Head of Institution.
Faculty Name sakshi dubey Unit 1 19
Question and answer session

Q&A
Faculty Name Unit 1 20

You might also like