2. LEARNING OUTCOMES:
At the end of the lesson, I should be able to:
a) Explain how data is represented
b) Demonstrate how data can be created and modified
c) Manipulate and modified data
d) Obtain a database design in relational model
3. RELATIONAL MODEL
A relational database management system
(RDBMS) is a database management system
(DBMS) that is based on relational model as
introduced by E.F. Codd.
4. TERMS IN RELATIONAL
MODEL
Tables: these are a collection of related data
entries and it consists of columns and rows.
Field: is a column in a table that is designed to
maintain specific information about every record
in the table.
Record: is a row of data or each individual entry
that exists in a table.
NULL value: is a field that is blank or with no
value.
5. CREATION AND
MODIFICATION OF
RELATIONS USING SQL
A database relation is a predefined row/column format for
storing information in a relational database.
Relations are equivalent to tables.
SQL stands for Structured Query Language
SQL lets you access and manipulate databases
SQL is an ANSI (American National Standards Institute)
standard
6. WHAT CAN SQL DO?
1. SQL can execute queries against a database
2. SQL can retrieve data from a database
3. SQL can insert records in a database
4. SQL can update records in a database
5. SQL can delete records from a database
6. SQL can create new databases
7. SQL can create new tables in a database
8. SQL can create stored procedures in a database
9. SQL can create views in a database
10. SQL can set permissions on tables, procedures, and
views
7. SQL COMMANDS
SELECT - extracts data from a database
UPDATE - updates data in a database
DELETE - deletes data from a database
INSERT INTO - inserts new data into a database
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index (search key)
DROP INDEX - deletes an index
8. CREATING TABLES IN MS ACCESS
Tables can be created in MS access by loading and clicking on
tables however,
To add fields to a table:
1. Click the Add New Field column label.
2. Activate the Datasheet tab.
3. Click Rename in the Fields & Columns group.
4. Type the field name.
5. Press Enter. Access creates the field.
6. Type the next field name. Access creates the field.
Continue until you have created all of the fields in your
table.
7. Press Enter without entering a field name to end your
entries.
9. Or
1. Right-click the Add New Field column label. A menu
appears.
2. Click Rename Column.
3. Type the field name.
4. Press Enter. Access creates the field.
5. Type the next field name. Access creates the field.
Continue until you have created all of the fields in your
table.
6. Name and Save a Table
After you create a table, you must name and save it.
10. HOW TO SAVE TABLES
1. Click the Save button on the Quick Access toolbar.
The Save As dialog box appears.
2. Type the name you want to give your table.
3. Click OK. Access names your table.
11. CREATING FORMS IN MS
ACCESS
1. Step 1: Open an existing database.
2. Step 2: Click on Forms Tab.
3. Step 3: Click on the New button.
4. Step 4: Use the Form Wizard.
5. Step 5: Select data source and fields for the form.
6. Step 6: Select a form Layout.
7. Step 7: Select a form Style.
8. Step 8: Name your Form.
12. CREATING REPORTS IN MS
ACCESS
To use the Report button:
1. Open the Navigation pane.
2. Click the table or query on which you want to base your
report.
3. Activate the Create tab.
4. Click the Report button in the Reports group. Access
creates your report and displays your report in Layout view.
You can modify the report.
13. QUERYING A DATABASE
Steps:
1. Start Microsoft Access and open your database.
2. Click on the Queries tab of your database.
3. Click on the New button and then select Design View
to start creating a query in Design view.
4. Choose the tables or other queries you wish to query.
5. Choose the fields from the table/query you want. [Just
like normal queries, you will often have to specify a
criterion in your query to get the results you want.]
6. Run the query to make sure your query contains the
results are you are looking for.
14. 7. Now, you need to change the type of query this is. In
the middle of the screen, click the Query type button
8. Change to Make-Table.
9. Specify the name of the new table and if it is going to
be created in the database you are currently working
from, or another database. [If you are creating the table
for a separate database, you will have to specify the
location of it.]
10. Run the query. Because you running an action query
that makes changes to your overall database structure,
Microsoft Access will ask if you want to cancel the
operation. Click Yes to close the dialog box, create the
new table and return to Query Design View.
11. Save your query, and you're done.