16
RELATIONAL MODELS 7/5/22

Relational models

Embed Size (px)

Citation preview

Page 1: Relational models

RELATIONAL MODELSWednesday, May 3, 2023

Page 2: Relational models

LEARNING OUTCOMES:At the end of the lesson, I should be able to:a) Explain how data is representedb) Demonstrate how data can be created and

modifiedc) Manipulate and modified datad) Obtain a database design in relational model

Page 3: Relational models

RELATIONAL MODELA relational database management system (RDBMS) is a database management system (DBMS) that is based on relational model as introduced by E.F. Codd.

Page 4: Relational models

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.

Page 5: Relational models

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 LanguageSQL lets you access and manipulate databasesSQL is an ANSI (American National Standards Institute) standard

Page 6: Relational models

WHAT CAN SQL DO?1. SQL can execute queries against a database2. SQL can retrieve data from a database3. SQL can insert records in a database4. SQL can update records in a database5. SQL can delete records from a database6. SQL can create new databases7. SQL can create new tables in a database8. SQL can create stored procedures in a database9. SQL can create views in a database10. SQL can set permissions on tables, procedures,

and views

Page 7: Relational models

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

Page 8: Relational models

CREATING TABLES IN MS ACCESSTables 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.

Page 9: Relational models

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.

Page 10: Relational models

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.

Page 11: Relational models

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.

Page 12: Relational models

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.

Page 13: Relational models

QUERYING A DATABASESteps: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.

Page 14: Relational models

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.

Page 15: Relational models

ASSIGNMENT

Page 16: Relational models

TERMINOLOGIES