Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
3Activity
0 of .
Results for:
No results containing your search query
P. 1
A2 Computing DDL DML

A2 Computing DDL DML

Ratings:

5.0

(1)
|Views: 221|Likes:
Published by robj
CPT 5 Course document.
CPT 5 Course document.

More info:

Published by: robj on May 15, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

09/20/2010

pdf

text

original

 
Data DefinitionLanguage (DDL)Explain the terms DDL and DML. Candidates should befamiliar with the use of a DDL to define a database.Data ManipulationLanguage (DML)
Typically, a DBMS provides the following facilitiesData Definition Language (DDL)
It allows a database designer to define the database using a
Data DefinitionLanguage (DDL)
provided for the particular DBMS. The DDL allows the designer tospecify the data types and structures, and the constraints on the data to be storedin the database.
Data Manipulation Language (DML)
It allows users to insert, update, delete and retrieve data from the databasethrough
a Data Manipulation Language (DML)
. Having a central repository for alldata and data descriptions allows the DML to provide a general enquiry facility tothis data, called a
query language
. Using a query language, directly or indirectly,enables new lines of enquiry to be constructed and satisfied quickly. A querylanguage is sufficiently high level to allow non-technical personnel to use it, easily.The most common query language is the
Structured Query Language
(SQL)
Using DDL to create a database
 
Create Database "c:\LibraryDB1.GDB" User"SYSDBA" Password "masterkey";Create Table Student(StudentIdNo Integer Not Null,Surname VarChar(20) Not Null,Primary Key (StudentIdNo));Create Unique Index StudentIDNoIndex OnStudent(StudentIDNo);
Simple ExampleSimpleExample.sql
 
Create Database 'c:\LibraryDB2.Gdb' User 'SYSDBA' Password'masterkey';Create Table Student(StudentIdNo Integer Not Null,Surname VarChar(15) Not Null,FirstName VarChar(10) Not Null,Primary Key (StudentIdNo));Create Table Book(BookIdNo Integer Not Null,Title VarChar(30) Not Null,ISBN VarChar(13) Not Null,Primary Key (BookIdNo));Create Table Loan(BookIdNo Integer Not Null,StudentIdNo Integer Not Null,LoanDate Date Not Null,Primary Key (BookIdNo),Foreign Key (StudentIdNo) ReferencesStudent(StudentIdNo),Foreign Key (BookIdNo) References Book(BookIdNo));Create Unique Index BookIDIndex On Book(BookIdNo);Create Unique Index StudentIdNo On Student(StudentIdNo);Create Unique Index LoanBookIdNoIndex On Loan(BookIdNo);Create Index LoanStudentIdNoIndex On Loan(StudentIdNo);
Example involvingforeign keys
 
Structured QueryLanguage (SQL)Illustrate the use of a Structured Query Languageusing the constructs Select, From, Where, In,Group By and Order By to extract data fromseveral tables of a relational database.
DML Examples
The following clauses are supported:SELECT FROM, WHERE, ORDER BY, GROUP BY, and HAVINGThe following aggregates are supported:SUM, AVG, MIN, MAX, COUNT The following operators are supported:+, -, *, /, =, < >, IS NULLUPDATE, INSERT, DELETE operations are fully supported.The following examples show DML statements used with standard databases.
EXAMPLE 1: UPDATE
UPDATE StudentSET SurnameName = ‘Bond’WHERE Student.StudentIdNo = 1
EXAMPLE 2: INSERT 
INSERT INTO Student (StudentIdNo, Surname)VALUES (1001, ‘Jones’)
EXAMPLE 3: DELETE
DELETEFROM StudentWHERE StudentIdNo = 3

Activity (3)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
rosshel_05 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->