database design and implementation. done so far… started a design of your own data model in...

11
Database Design And Implementation

Upload: norman-potter

Post on 17-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Database Design And Implementation. Done so far… Started a design of your own data model In Software Engineering, recognised the processes that occur

Database Design

And Implementation

Page 2: Database Design And Implementation. Done so far… Started a design of your own data model In Software Engineering, recognised the processes that occur

Done so far…

• Started a design of your own data model

• In Software Engineering, recognised the processes that occur in the system.

Page 3: Database Design And Implementation. Done so far… Started a design of your own data model In Software Engineering, recognised the processes that occur

To do…

• Implement the data model using CREATE statements– In SQL Server– In Oracle

• Populate the data model using inserts• Design

– Queries that will be relevant to the system– Transactions that will cause the data to flow

through the system.

Page 4: Database Design And Implementation. Done so far… Started a design of your own data model In Software Engineering, recognised the processes that occur

Data model

– Give the attributes:• data types• Check constraints

– Note any checks that need to be done that cannot be done in the CREATE statement.

• Later, these can be implemented through triggers.

– Decide on the sample of data you want to use to populate your model.

Page 5: Database Design And Implementation. Done so far… Started a design of your own data model In Software Engineering, recognised the processes that occur

Implementing your model in SQL Server

• Keep your SQL Server SQL separate from your Oracle SQL.– Set up a SQL Server implementation directory

for your .SQL files.• E.g. U:\databases\SQLServer\MYMODEL.SQL

– Implement the CREATEs in SQL Server– Populate the model using ‘INSERT’

statements.

Page 6: Database Design And Implementation. Done so far… Started a design of your own data model In Software Engineering, recognised the processes that occur

Implementing your model in SQL Server

• Keep your SQL Server SQL separate from your Oracle SQL.– Set up a SQL Server implementation directory

for your .SQL files.• E.g. U:\databases\SQLServer\MYMODEL.SQL

– Implement the CREATEs in SQL Server– Populate the model using ‘INSERT’

statements.

Page 7: Database Design And Implementation. Done so far… Started a design of your own data model In Software Engineering, recognised the processes that occur

Copy to Oracle

• Set up an Oracle implementation directory– E.g. U:\databases\Oracle\

• Copy the SQL from your SQL Server directory

• Note the differences in syntax between Oracle create and SQL Server create.

• Change the Oracle SQL.

Page 8: Database Design And Implementation. Done so far… Started a design of your own data model In Software Engineering, recognised the processes that occur

Design your processes

• Using the processes uncovered in Software Engineering– Design transactions to implement those

processes

• Design queries that would be useful in your system.– When you think about this, it can help you to

decide what data you want in your system.

Page 9: Database Design And Implementation. Done so far… Started a design of your own data model In Software Engineering, recognised the processes that occur

More Data Manipulation language

• We have done:– Insert– Select

• To do:– Delete– Update

Page 10: Database Design And Implementation. Done so far… Started a design of your own data model In Software Engineering, recognised the processes that occur

Delete

• To delete from a table:– Delete from <table> where <condition>

• E.g.(see handout)– Delete from STUDENT where MINIT like ‘B’;

• Note:– 1. This may not work. Look at the handout

and decide why.

Page 11: Database Design And Implementation. Done so far… Started a design of your own data model In Software Engineering, recognised the processes that occur

Update

Update <tablename>

set <field> = <expression>

Where <condition>

e.g.

Update student

set FNAME = ‘Sidney’

Where SID = 2222;