Laboratory 5: Introduction To SQL: MN405 Data and Information Management
Laboratory 5: Introduction To SQL: MN405 Data and Information Management
Submission Due: End of laboratory class, submit the file on Moodle at least 10 minutes
before the end of laboratory class.
Marks will be given only to students who attend and participate during 2 hours laboratory
class. Submission on Moodle is mandatory as an evidence of participation.
The purpose of this assignment is to introduce Database concepts such as entity, attributes,
Primary key and relationships..
Exercises
Download this Laboratory exercise to your hard drive, write your answers and upload
on to the Moodle submission link.
a. Open the file in Microsoft Access. We will be using this database file in first
few weeks’ laboratory classes.
Prepared by: Dr. Deepani Guruge Moderated By: Prof. Savitri Bevinakoppa T1, 2021
MN405 Data and Information Management Page 2 of 2
d. Fill the following table by opening the relations/ tables by double clicking on
them.
1. customer 9 CustomerNum,
CustomerName……
2. …
3. ...
Table 1
2. Open each relation and move to design view by clicking buttons on the bottom
right corner.
a. Identify the data type of each attribute(Field name) in Design view
b. Now add a new column to table1 above, created in question 5 and name it as
Primary Key. Find the Primary key of each table and enter.
Every table in your database should have a Primary key. Primary key is a
column or collection of columns of a table (relation) that uniquely identifies a
given row in that table.
c. Enter new field “Age”, to customer table. You need to Click on the design
view.
d. Change the primary key of “Customer” table to “customerName”. This is not
easy. You can’t change the Primary when it is joined
e. Select data sheet view and enter data into this new “Age” field.
3.
Open query window in Microsoft Access. to create queries
1. To create a new query, click CREATE on the ribbon to display the CREATE
tab,
Prepared by: Dr. Deepani Guruge Moderated By: Prof. Savitri Bevinakoppa T1, 2021
MN405 Data and Information Management Page 3 of 3
2. Then click the Query Design button in the Queries group to create a query
and click the Close button in the Show Table dialog box.
3. Click the View button arrow in the Results group on the QUERY TOOLS
DESIGN tab and then click SQL View.
4. Now you can create the query.
5. To run the SQL Command, click the Run button in the Results group on the
QUERY TOOLS DESIGN tab.
Write queries to
o List the number and name of all customers that are represented by rep 15.
o List the number and name of all customers that are represented by rep 15 and
that have a credit limit of $10,000.
Create new database called “Academic”. Add 2 tables; Student and Mark tables with
suitable attributes to the Academic database. Populate those tables with suitable data
records (at least 3 records per table).
Prepared by: Dr. Deepani Guruge Moderated By: Prof. Savitri Bevinakoppa T1, 2021