0% found this document useful (0 votes)
20 views

Assignment 1 DBMS

Uploaded by

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

Assignment 1 DBMS

Uploaded by

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

NAME: Scotty Berthelot

HW 1
CS 623

You have several exercises to do in this assignment. You will submit this file with your
answers. Do not change the order of the questions and do not remove anything from the
file. Write your answers inline.

Exercise Points Max points


1 5 (Discord)
2 15
3 24
4 20
5 24
6 12
Total 100

Exercise 1. Discord

Post your introduction in the discussion board. Who you are? Your degree? Your
location? What you expect from the course?

Introduction

Exercise 2. Research

Read the paper entitled 'Databases Research: Achievements and Opportunities


Into the 21st Century' by A. Silberschatz, M. Stonebraker and J. Ullman. This survey
paper appeared in SIGMOD 96, Vol. 25, No. 1 in March 1996. This is a reference paper.
It is old but it provides a very good overview of the domain. It presents the vision of
researchers in the field who are still considered today as experts. The paper is available
using Google Search.
You can consult the latest SIGMOD conferences to have ideas about the evolution of the
field.

Answer these questions:


• What topic is mentioned as an opportunity in databases? (Choose one)
• What were the predicted advancements of this topic?
• What are the results of the research on this topic today?

5-10 lines for each question.

What topic is mentioned as Healthcare is an opportunity in database. It facilitates for


an opportunity in databases? patients and caregivers to exchange informations
(Choose one)

What were the predicted The predicted advancements were about the complex
advancements of this topic? queries and how different techniques can support said
queries with a better language
What are the results of the The results of this topic today is data warehousing.
research on this topic Allowing the exchange of data and making it more
today? available

Exercise 3. Foundation: Set Theory

Lecture notes: ‘A little of mathematics’.

Answer by true or false to these questions and explain:

1. A x B = B x A

True, property of multiplication

2. | A x B | = | B x A|

True, determine the product of matrices is equal to the product of the


determinants

3. A U B = B U A
True, union of sets is commutative operation meaning the order in which
sets are combined does not matter

Answer the following questions:

4. Let S ={a,b,c,d} and T={{},a}.

4.1. Compute S x T.

S x T = {(a, {}), (a,a), (b, {}), (b,a), (c, {}), (c,a),(d,{}).(d,a)

4.2. How many elements are there in the Powerset of S?

2^n=2^4=16

4.3. Compute the Powerset of S.

P(S) = {{},{a},{b},{c},{d},{a, b}, {a, c}, {a, d}, {b, c}, {b, d}, {c, d},{a, b, c},
{a, c, d}, {a, b, d}, {b, c, d},{a, b, c, d}

4. Explain why the Cartesian product of 2 sets is an inefficient operation to


perform. Be very specific and use numbers.

It can take too long to produce a result I.e; A×B = {(a1,b1), (a1,b2), (a1,b3), ( a2,b1),
(a2,b2),(a2,b3), (a3,b1), (a3,b2), (a3,b3)}. But A has 1 million elements and B has 2
millions elements

Exercise 4. Tools

Download and install the following software on your computer. You will test the
installation. Save your logins, passwords and ports. Write down in what directories the
software are installed. If you do not do this, you may get issues in the future.

• MySQL. Latest version. https://dev.mysql.com/downloads/mysql (Community


Server).
• PostgreSQL. Latest version. https://www.enterprisedb.com/downloads/postgres-
postgresql-downloads
Use professional forums (e.g., StackOverFlow) and the Week 1 discussion board in case
of difficulty with installation.

These software will be used during the semester.

Create screenshots to prove that you installed the software on your computer.

How to run MySQL? [Windows only]

[Command line version]

There is a graphical environment for MySQL but I prefer the command line version. You
are free to use the GUI version.

Be sure that the MySQL service is running.

You need to be in the directory where MySQL is installed (bin directory) or have bin in
your path.

Type mysql –u root –p and the password

You can now type MySQL commands


SHOW DATABASES;
CREATE DATABASE TEST;
USE TEST;
SHOW TABLES;
CREATE TABLE Student(studid INTEGER, name VARCHAR(20), address
VARCHAR(30), status CHAR(1));
QUIT;
Note: Please put all SQL keywords in capital letter for readability.
How to run PostgreSQL? [Windows only]

Video: https://www.youtube.com/watch?v=1GlQpflJZTU
Tutorial:
http://info.enterprisedb.com/rs/069-ALB-339/images/
Tutorial_Getting_Started_with_Advanced_Server_on_Windows.pdf

Be sure that PostgreSQL is running in Services.


PostgreSQL can be used with the graphical environment and with the command line.

Graphical environment

Launch pgAdmin from the Start menu of Windows. Update to pgAdmin version XX.

Connect to PostgreSQL XX using the password you specified.

Create a table.
Command line

Launch the psql shell and connect.

Create the table Student.


CREATE TABLE Student(studid INTEGER, name VARCHAR(20), address
VARCHAR(30), status CHAR(1));
Post screenshots of your work.

For MySQL.

For PostgreSQL.
Exercise 5. SQL
You will do the same exercise in MySQL and PostgreSQL.

1. Create the table Student and Transcript.

• Student: studid, name, address, status


o Primary key: studid
• Transcript: studid, crscode, semester, grade
o Primary key: studid, crscode, semester
o Do not use foreign keys!
MySQL PostgreSQL

2. Populate each table with at least 3 rows using INSERT INTO.

Provide the code and screenshots to support your work. Integrate the screenshots here.

MySQL PostgreSQL

Exercise 6. Integrity Constraints and Transactions


A reservation transaction in an airline reservation system makes a reservation on a flight,
reserves a seat on the plane, issues a ticket, and debits the appropriate credit card account.
Assume that one of the integrity constraints of the reservation database is that the number
of reservations on each flight does not exceed the number of seats on the plane. (Of
course, many airlines purposely overbook and so do not use this integrity constraint).

Explain how transactions running on this system might violate each of the following
properties. Provide an example for each property.

• Atomicity
• Consistency
• Isolation
• Durability

Atomicity If the card declines the transaction should not be able to go


through. When it declines the card cannot go back to the original
state
Consistency If the card declines after the tickets was issued it could pose
problem regarding the number of seats available therefore less
reservations available on an unstable basis
Isolation The same seats and tickets cannot be issued twice. Each customer
should be able to overlap on their reservation, the system has to
be able to overbook
Durability The system can crash at any given moment but all saved data
should be save so that when it happens it could revert back up
until the last backup

You might also like