Databases. Question 1: What does SQL stand for?...

10
Databases

Transcript of Databases. Question 1: What does SQL stand for?...

Page 1: Databases. Question 1: What does SQL stand for? …………………………………………………………………… (1 point) Question 2: Considering programming paradigms,

Databases

Page 2: Databases. Question 1: What does SQL stand for? …………………………………………………………………… (1 point) Question 2: Considering programming paradigms,

Question 1: What does SQL stand for?

…………………………………………………………………… (1 point)

Question 2: Considering programming paradigms, what kind of language is SQL?

…………………………………………………………………… (1 point)

Question 3: Explain what purpose you would use SQL Language for.

……………………………………………………………………………………………………………………………………………………………………………………………………………… (2 points)

Page 3: Databases. Question 1: What does SQL stand for? …………………………………………………………………… (1 point) Question 2: Considering programming paradigms,

Question 4 a) What is the purpose of a primary key?

…………………………………………………………………… (1 point)

Question 4 b) What is the purpose of a foreign key?

…………………………………………………………………… (1 point)

Question 4 c) What is the term used for the act of splitting out data within a database using these keys?

…………………………………………………………………… (1 point)

Page 4: Databases. Question 1: What does SQL stand for? …………………………………………………………………… (1 point) Question 2: Considering programming paradigms,

Question 5:

You are designing an application for a music company that sells music downloads online. Within their business design the company asks you to design the website which will sell these downloads.

You will be working on the principal that the company sells multiple tracks which may also be sold as albums from a variety of artists.

A): How would you complete the following ERD?

(1 point)

Track Album

Page 5: Databases. Question 1: What does SQL stand for? …………………………………………………………………… (1 point) Question 2: Considering programming paradigms,

B): How would you complete the following DFD?

(3 points)

Customer

Download

Page 6: Databases. Question 1: What does SQL stand for? …………………………………………………………………… (1 point) Question 2: Considering programming paradigms,

C) Explain Third Normal Form.

………………………………………………………………………………………………………………………………………… (2 points)

D) Your database will include tables named tbl_tracks, tbl_albums and tbl_artists. How would you split your fields between these to ensure the application meets 3NF?

(3 points)

tbl_tracks tbl_albums tbl_artists

Page 7: Databases. Question 1: What does SQL stand for? …………………………………………………………………… (1 point) Question 2: Considering programming paradigms,

E) You are required to add a new record to tbl_albums. Complete the SQL statement below:

……………………………….tbl_albums…………………(………………………………………………..)

(2 points)

F) You are required to update an existing record in tbl_artists. Complete the SQL statement below:

…………………..tbl_artists…………..(……………………………………………………...)…………………………………………………………………….

(3 points)

G) You are required to output all records in tbl_albums that begin with ‘B’. Complete the SQL statement below:

…………………………………………….tbl_albums…………………………………………………………………….

(2 points)

Page 8: Databases. Question 1: What does SQL stand for? …………………………………………………………………… (1 point) Question 2: Considering programming paradigms,

H) You are required to output all records in tbl_tracks in alphabetical order. Complete the SQL statement below

…………………………………………….tbl_tracks…………………………………………………………………….

(3 points)

I) You are required to output the number of records output in the statement above. Complete the SQL statement below:

……………………………………………………….………………………………….tbl_tracks

(2 points)

J) You are required to output all records in tbl_tracks grouped by their album. Complete the SQL statement below:

…………………………………………….tbl_tracks…………………………………………………………… (2

points)

Page 9: Databases. Question 1: What does SQL stand for? …………………………………………………………………… (1 point) Question 2: Considering programming paradigms,

E) You are required to add a new record to tbl_albums. Complete the SQL statement below:

INSERT INTO tbl_albums (AlbumName, ArtistId, Price)VALUES (“American Idiot”, 22, 7.99)

(2 points)

F) You are required to update an existing record in tbl_artists. Complete the SQL statement below:

UPDATE tbl_artistsSET (ArtistName = “Green Day”, Genre = “Punk”)WHERE ArtistId = 22

(3 points)

G) You are required to output all records in tbl_albums that begin with ‘B’. Complete the SQL statement below:

SELECT *FROM tbl_albumsWHERE AlbumName LIKE ‘B%’

(2 points)

Page 10: Databases. Question 1: What does SQL stand for? …………………………………………………………………… (1 point) Question 2: Considering programming paradigms,

H) You are required to output all records in tbl_tracks in alphabetical order. Complete the SQL statement below

SELECT *FROM tbl_tracksORDER BY trackName

(2 points)

I) You are required to output the number of records output in the statement above. Complete the SQL statement below:

SELECT (COUNT trackName)FROM tbl_tracks

(2 points)

J) You are required to output all records in tbl_tracks grouped by their album. Complete the SQL statement below:

SELECT *FROM tbl_tracksGROUP BY albumId

(2 points)