database management systems -- (itcs 385)
DESCRIPTION
DATABASE MANAGEMENT SYSTEMS -- (ITCS 385). Mrs. Basma Alsadiq [email protected] S40-1060. Database. Database is a collection of records. It is an organized collection of information. There are many types of database. Relational Database Management System. SQL. - PowerPoint PPT PresentationTRANSCRIPT
Mrs. Basma [email protected]
S40-1060
Database is a collection of records. It is an organized collection of information. There are many types of database.
Structured Query Language (SQL) is the language used to manipulate relational database
Structured Query Language (SQL) Standard query language for relational
databases Query: command to perform
operation on database object Create Modify View Delete
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
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
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
An Oracle database consists of multiple user accounts
Each user account owns database objects Tables Views Stored programs Etc.
Start Using SQL & SQL*PLUS
is a client terminal software allowing users to interact with Oracle server to manipulate data and data structures.
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),
…..
);
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
CREATE TABLE student( ID Number(8), Name Varchar(15), GPA Decimal(3,2), Major Varchar(5), DOB Date);
If a table in the database is not needed any longer , then we can delete it using DROP TABLE command
Example:
Drop TABLE employee
Using ALTER TABLE command Syntax:
ALTER TABLE <table_name>
ADD <column_name> <datatype>(size)
Using ALTER TABLE command Syntax:ALTER TABLE <table_name>
Modify <column_name> <datatype>(size)
Using ALTER TABLE command Syntax:
ALTER TABLE <table_name>
DROP COLUMN <column_name>;
To change the name of a table, use the following statement.Syntax:
ALTER TABLE <table_name>
rename to <new-name>
To change the name of a table column, use RENAME statement.Syntax:
ALTER TABLE <table_name>
rename column <old-name> to <new-name>