DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)
description
Transcript of DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)
![Page 2: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/2.jpg)
Database is a collection of records. It is an organized collection of information. There are many types of database.
![Page 3: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/3.jpg)
![Page 4: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/4.jpg)
![Page 5: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/5.jpg)
Structured Query Language (SQL) is the language used to manipulate relational database
![Page 6: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/6.jpg)
Structured Query Language (SQL) Standard query language for relational
databases Query: command to perform
operation on database object Create Modify View Delete
![Page 7: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/7.jpg)
![Page 8: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/8.jpg)
Data Definition Language (DDL) Used to create and modify the structure of
database objects Data Manipulation Language (DML)
Used to insert, update, delete, and view database data
![Page 9: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/9.jpg)
Used to create and modify the structure of database objects CREATE ALTER DROP
DDL commands execute as soon as they are issued, and do not need to be explicitly saved
![Page 10: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/10.jpg)
Used to insert, view, and modify database data INSERT UPDATE DELETE SELECT
DML commands need to be explicitly saved or rolled back COMMIT ROLLBACK
Transaction control commands
![Page 11: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/11.jpg)
An Oracle database consists of multiple user accounts
Each user account owns database objects Tables Views Stored programs Etc.
![Page 12: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/12.jpg)
Start Using SQL & SQL*PLUS
![Page 13: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/13.jpg)
is a client terminal software allowing users to interact with Oracle server to manipulate data and data structures.
![Page 14: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/14.jpg)
![Page 15: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/15.jpg)
![Page 16: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/16.jpg)
Creating tables is the first step in making your own database, and it follows the syntax:
CREATE TABLE tablename(
Column1 datatype(size),
Column2 datatype(size),
…..
);
![Page 17: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/17.jpg)
Datatype Description
VARCHAR(n) Variable-length character data (n is the maximum number of characters)
CHAR(n) CHARACTER(n)
Fixed-length character data (n is the number of characters)
NUMERIC(p,s) DECIMAL(p,s)
Variable-length numeric data (p is the precision, s is the scale
INTInteger value
DATE Calendar date (DD-MMM-YYYY)
TIMEClock time (HH:MM:SS)
TIMESTAMP Date & time
![Page 18: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/18.jpg)
CREATE TABLE student( ID Number(8), Name Varchar(15), GPA Decimal(3,2), Major Varchar(5), DOB Date);
![Page 19: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/19.jpg)
If a table in the database is not needed any longer , then we can delete it using DROP TABLE command
Example:
Drop TABLE employee
![Page 20: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/20.jpg)
Using ALTER TABLE command Syntax:
ALTER TABLE <table_name>
ADD <column_name> <datatype>(size)
![Page 21: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/21.jpg)
Using ALTER TABLE command Syntax:ALTER TABLE <table_name>
Modify <column_name> <datatype>(size)
![Page 22: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/22.jpg)
Using ALTER TABLE command Syntax:
ALTER TABLE <table_name>
DROP COLUMN <column_name>;
![Page 23: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/23.jpg)
To change the name of a table, use the following statement.Syntax:
ALTER TABLE <table_name>
rename to <new-name>
![Page 24: DATABASE MANAGEMENT SYSTEMS -- (ITCS 385)](https://reader035.fdocuments.in/reader035/viewer/2022062222/568158ce550346895dc61806/html5/thumbnails/24.jpg)
To change the name of a table column, use RENAME statement.Syntax:
ALTER TABLE <table_name>
rename column <old-name> to <new-name>