database management systems -- (itcs 385)

24
Mrs. Basma Alsadiq [email protected] S40-1060

Upload: acton

Post on 01-Feb-2016

62 views

Category:

Documents


0 download

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 Presentation

TRANSCRIPT

Page 1: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)

Mrs. Basma [email protected]

S40-1060

Page 2: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)

Database is a collection of records. It is an organized collection of information. There are many types of database.

Balqees Al.Mubarak
the database is centralized, and can be used by many database managment systems.
Page 3: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)
Page 4: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)
Page 5: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)

Structured Query Language (SQL) is the language used to manipulate relational database

Page 6: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)

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)
Page 8: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)

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)

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)

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)

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)

Start Using SQL & SQL*PLUS

Page 13: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)

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)
Page 15: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)
Page 16: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)

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)

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)

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)

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)

Using ALTER TABLE command Syntax:

ALTER TABLE <table_name>

ADD <column_name> <datatype>(size)

Page 21: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)

Using ALTER TABLE command Syntax:ALTER TABLE <table_name>

Modify <column_name> <datatype>(size)

Page 22: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)

Using ALTER TABLE command Syntax:

ALTER TABLE <table_name>

DROP COLUMN <column_name>;

Page 23: DATABASE MANAGEMENT SYSTEMS  -- (ITCS 385)

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)

To change the name of a table column, use RENAME statement.Syntax:

ALTER TABLE <table_name>

rename column <old-name> to <new-name>