Professional Documents
Culture Documents
DATABASELANGUAGESandLEVELS
DatabaseLanguageLevels
EachLevelhasaDefinitionLanguage
Internal
StorageDefinitionLanguage
Conceptual
DataDefinitionLanguage
External(User)
ViewDefinitionLanguage
Definedatasstructure
1
8/6/2015
DataDefinitionLanguage
LogicalStructure
RecordTypes
ofConceptual Attributes
LevelData
Rulesgoverning Rulesforeachtable
Rulesaboutconnectionsbetween
DB tables
Conceptual:DDL
Rule about table
create table employee (
fname varchar(15) not null,
lname varchar(15) not null,
ssn char(9) primary key,
dno number(3)foreign key references
department);
2
8/6/2015
StorageDefinitionLanguage
PhysicalStructure
Bytesperfield
Orderoffields
Sorting
Access(hash,Btree)
FileStructure
MixedRecords,etc.
SDLExample
create table employee ( ,
initrans 3, /* simul updates */
pctfree 30, /* use new block */
initial 7,
next 7); /* space allocated */
Beyondscopeofthiscourse
3
8/6/2015
ViewDefinitionLanguage
DefineSubsetsofrecordsavailabletoclassesofuser.
Create"virtualtables"frombasetables.
Viewappearstouserlikeconceptuallevel.
VDLExamples
create view emp5 as
select * from employee
where dno = 5;
Seeonlydept 5employees
create view empdept as
select fname,lname,dno,dname
from employee,department
where dno=dnumber;
Makebothdept numberandnameavailable.
4
8/6/2015
ViewExamples,cont.
Create view stats as
select dname,count(*),avg(salary),
from employee, department
where dno = dnumber
group by dname;
ThiscountandaveragedonotexistinanyDBtable.
Calculated from existing
data in database
DataManipulationLanguage
Usedatconceptuallevel
andatExternalLevel.
query(requestinfo)
delete
update
insert
5
8/6/2015
DMLexamples
view
select * from stats
where dname = Research;
insert into works_on
values(123456789,7,15);
table
update works_on
set hours = 10
where essn = 123456789
and pno = 7;
StandardSQLDefines
ConceptualLevelDDL(DataDefinitionLang)
ConceptualLevelDML(DataManipulation)
ExternalLevelDDL
ViewsaredefinedasQuerieswithnames
ExternalLevelDML(sameasConceptual)
NOStorageDefinitionLanguage
6
8/6/2015
OracleDBDefinition
AddsSDLconstructstoStandardSQLDDL.
AlsostructuresdatabasewithConfigurationFiles
ThisisprovinceofDBAdministration.
BeyondtheScopeofthisCourse