0% found this document useful (0 votes)
75 views4 pages

Cpe El1 Table Restriction

This laboratory report discusses table restrictions in a database. It explains that primary keys uniquely identify records in a table and foreign keys establish relationships between tables. The objectives are to implement restrictions on tables and familiarize data validation. The report implements primary and foreign keys on tables, creates new tables, and concludes that primary and foreign keys are important restrictions for connecting and distinguishing records in a database.

Uploaded by

Alecxis Caringal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views4 pages

Cpe El1 Table Restriction

This laboratory report discusses table restrictions in a database. It explains that primary keys uniquely identify records in a table and foreign keys establish relationships between tables. The objectives are to implement restrictions on tables and familiarize data validation. The report implements primary and foreign keys on tables, creates new tables, and concludes that primary and foreign keys are important restrictions for connecting and distinguishing records in a database.

Uploaded by

Alecxis Caringal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CpE EL1 – Software Development

LABORATORY REPORT: TABLE RESTRICTIONS


Caringal, Alecxis T.
Computer Engineering, College of Engineering
Colegio San Agustin – Bacolod

Abstract

Keys are fundamental elements of the relational database because they establish a
relationship between a pair of tables and ensure each record in a table is uniquely identified. Keys
have a more particular significance than establishing relationships; they also help with Referential
Integrity and they are a major component of table-level integrity. Tables store huge chunks of data
in them which usually extend to thousands of records all of which are unsorted and disorganized.
Fetching a particular data from those numerous records can be difficult at times or sometimes
impossible.

I. INTRODUCTION

Data constraints: Besides the cell name, cell length and cell data type there are other
parameters i.e. other data constrains that can be passed to the DBA at check creation time. The
constraints can either be placed at column level or at the table level.

• Column Level Constraints: If the constraints are defined along with the column
definition, it is called a column level constraint.
• Table Level Constraints: If the data constraint attached to a specify cell in a table
reference the contents of another cell in the table then the user will have to use table level
constraints.

The objectives of this laboratory experiment are the following:


1. Implement the restrictions on the table
2. Familiarize data validation

II. IMPLEMENTATION

In this chapter will discuss about the laboratory exercise procedure. The procedures of this
laboratory experiment will guide about the data that I came up.

A. Backup Previous Database from Lab1


I created a new database for this laboratory exercise and copied the two tables from
borrowers_db (Lab 1).

B. Implement the ALTER TABLE function query


After understanding the ALTER TABLE function query, I implemented it on the
books_tbl and borrower_tbl.

CPE 303B – LOGIC CIRCUITS AND SWITCHING THEORY Page 1 of 4


by: Engr. Jeremiah Dearborn F. Gangoso, CpE
C. Create tables
Create the 3 tables and set up the columns and its data type based on the data provided.

D. Primary key and Foreign key constraint


Set the specified field to primary key and foreign key.

III. EXPERIMENTAL FINDINGS

This chapter is about the presentation of the output that I gathered based on the laboratory
exercise given.

1. Make primary keys for the following tables:


a. books_tbl : book_id as PRIMARY KEY

b. borrower_tbl : borrower_id as PRIMARY KEY

CPE 303B – LOGIC CIRCUITS AND SWITCHING THEORY Page 2 of 4


by: Engr. Jeremiah Dearborn F. Gangoso, CpE
2. Make the following tables:

a. Supplier_tbl

b. book_rental_tbl

c. book_rental_info_tbl

IV. CONCLUSIONS

This laboratory exercise guides me to learn about the SQL Primary Key and SQL Foreign
Key. I also learned at how SQL Create Table Primary Key and SQL Create table Foreign Key.
CPE 303B – LOGIC CIRCUITS AND SWITCHING THEORY Page 3 of 4
by: Engr. Jeremiah Dearborn F. Gangoso, CpE
Through the process, I understand that Primary key is a field in a table which distinguishes
each line or record in a database table while Foreign Key is used to connect two tables
together.

In conclusion, primary and foreign key are the restrictions that I can use on my tables in
the Database. After implementing the foreign and primary key and familiarize about the
data validation, I could use those things I learned in the future.

References

https://www.w3schools.com/sql/sql_primarykey.asp
https://data-flair.training/blogs/primary-and-foreign-key-in-sql/
http://www.differencebetween.net/technology/difference-between-primary-key-and-
foreign-key/

CPE 303B – LOGIC CIRCUITS AND SWITCHING THEORY Page 4 of 4


by: Engr. Jeremiah Dearborn F. Gangoso, CpE

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy