D427 Practice Test 1 with Answer Key
.docx
keyboard_arrow_up
School
Western Governors University *
*We aren’t endorsed by this school
Course
427
Subject
Computer Science
Date
Apr 3, 2024
Type
docx
Pages
23
Uploaded by UltraElementLoris27
D427 Practice Test 1
1.
Seattle, WA 98111
USA How many attributes are present in the address fragment?
a.
1
b.
2
c.
3
d.
4
2.
The Book table has the following columns:
genre – varchar(20)
pages – integer
author_id – char(3)
isbn_number – varchar(20)
Which column should be designated at the primary key for the Book table? a.
genre
b.
pages
c.
author_id
d.
isbn_number
3.
The Book table has the following columns:
genre – varchar(20)
pages – integer
author_id – char(3)
isbn_number – varchar(20)
Which column should be designated at the foreign key for the Book table? a.
genre
b.
pages
c.
author_id
d.
isbn_number
4.
Which data type represents numbers with fractional values:
a.
Integer
b.
Decimal
c.
Character
d.
Binary
5.
Which of the following are DDL commands?
a.
INSERT
b.
SELECT
c.
CREATE INDEX
d.
UPDATE
6.
Which of the following is a DML command?
a.
CREATE VIEW
b.
CREATE TABLE
c.
INSERT
d.
ALTER INDEX
7.
CREATE TABLE Invoice ( invoice_id INT NOT NULL AUTO_INCREMENT, date DATE NOT NULL, customer_id INT NOT NULL, PRIMARY KEY (invoice_id),
FOREIGN KEY (customer_id) REFERENCES Customer (customer_id)
ON DELETE CASCADE
);
Looking at the Customer and Invoice tables and the CREATE TABLE for the Invoice table with foreign key reference statement above, what would happen to invoices in the Invoice table that are linked to a customer if that customer is deleted. a.
Those invoices would remain in the database.
b.
Those invoices would be deleted also.
c.
The Customer ID for those invoices would be changed to NULL.
d.
Nothing would happen.
8.
Invoice ID (PK) Date Customer ID (FK) Customer ID (PK)
Customer Last Name Customer First Name Street Address City State Zip
CREATE TABLE Invoice ( invoice_id INT NOT NULL AUTO_INCREMENT, date DATE NOT NULL, customer_id INT NOT NULL, PRIMARY KEY (invoice_id),
FOREIGN KEY (customer_id) REFERENCES Customer (customer_id)
ON DELETE RESTRICT
);
Looking at the Customer and Invoice tables and the CREATE TABLE for the Invoice table with foreign key reference statement above, what would happen to invoices in the Invoice table that are linked to a customer if that customer is deleted. a.
Those invoices would remain in the database.
b.
Those invoices would be deleted also.
c.
The Customer ID for those invoices would be changed to NULL.
d.
The delete of the Customer would not be allowed. 9.
CREATE TABLE Invoice ( invoice_id INT NOT NULL AUTO_INCREMENT, date DATE NOT NULL, customer_id INT NOT NULL, PRIMARY KEY (invoice_id),
FOREIGN KEY (customer_id) REFERENCES Customer (customer_id)
ON DELETE SET TO NULL
Invoice ID (PK) Date Customer ID (FK) Customer ID (PK)
Customer Last Name Customer First Name Street Address City State Zip
);
Looking at the Customer and Invoice tables and the CREATE TABLE for the Invoice table with foreign key reference statement above, what would happen to invoices in the Invoice table that are linked to a customer if that customer is deleted. e.
Those invoices would remain in the database.
f.
Those invoices would be deleted also.
g.
The Customer ID for those invoices would be changed to NULL.
h.
The delete of the Customer would not be allowed. 10.
Which of the following are true about materialized view (Choose 2)?
a.
It is a base table.
b.
It is stored.
c.
It must be refreshed whenever the base table changes.
d.
The results are stored as a temporary table.
11. The
Customer
table will have the following columns:
CustomerID—positive integer
FirstName—variable-length string with up to 50 characters
MiddleInitial—fixed-length string with 1 character
LastName—variable-length string with up to 50 characters
DateOfBirth—date
CreditLimit—positive decimal value representing a cost of up to $19,999, with 2 digits for cents
Invoice ID (PK) Date Customer ID (FK) Customer ID (PK)
Customer Last Name Customer First Name Street Address City State Zip
Write a SQL statement to create the
Customer
table.
Do not add any additional constraints to any column beyond what is stated.
12. The
Genre
table has the following columns:
GenreCode—variable-length string, primary key
GenreDescription—variable-length string
The
Book
table should have the following columns:
Title—variable-length string, maximum 30 characters
GenreCode—variable-length string, maximum 5 characters
Write a SQL statement to create the
Book
table. Designate the
GenreCode
column in the
Book
table as a
foreign key to the
GenreCode
column in the
Genre
table.
13. The
Automobile
table has the following columns:
ID—integer, primary key
Make—variable-length string
Model—variable-length string
Year—integer
A new column must be added to the
Automobile
table:
Column name:
SafetyRating
Data type: A positive number that is less than 80 with 1 decimal space. Write a SQL statement to add the
SafetyRating
column to the
Automobile
table
14. The
Book
table has the following columns:
ID—integer, primary key
Title—variable-length string
Genre—variable-length string
Year—integer
Write a SQL statement to create a view named
MyBooks
that contains the
Title,
Genre, and
Year
columns for all books. Ensure your result set returns the columns in the order indicated.
15. A database has a view named
BookView.
Write a SQL statement to delete the view named
BookView
from the database.
16. The
Book
table has the following columns:
ID—integer
Title—variable-length string
Genre—variable-length string
Year—integer
Write a SQL statement to modify the
Book
table to make the
ID
column the primary key.
17. The
Book
table has the following columns:
ID—integer, primary key
Title—variable-length string
Genre—variable-length string
Year—integer
The
YearSales
table has the following columns:
Year—integer
TotalSales—bigint unsigned
Releases—integer
Write a SQL statement to designate the
Year
column in the
Book
table as a foreign key to the
Year
column in the
YearSales
table.
18. The
Book
table has the following columns:
ID—integer, primary key
Title—variable-length string
Genre—variable-length string
Year—integer
Write a SQL statement to create an index named
idx_year
on the
Year
column of the
Book
table.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
PHP script
arrow_forward
Write Mysql code for:
The database has three tables for tracking horse-riding lessons:
Horse with columns:
ID - primary key
RegisteredName
Breed
Height
BirthDate
Student with columns:
ID - primary key
FirstName
LastName
Street
City
State
Zip
Phone
EmailAddress
LessonSchedule with columns:
HorseID - partial primary key, foreign key references Horse(ID)
StudentID - foreign key references Student(ID)
LessonDateTime - partial primary key
Write a SELECT statement to create a lesson schedule for Feb 1, 2020 with the lesson date/time, student's first and last names, and the horse's registered name. Order the results in ascending order by lesson date/time, then by the horse's registered name. Make sure unassigned lesson times (student ID is NULL) appear in the results.
Hint: Perform a join on the LessonSchedule, Student, and Horse tables, matching the student IDs and horse IDs.
arrow_forward
Table is necessary
arrow_forward
Write an XML file that describes information of students in a class. The following
table has the students' details:
Name
ID
Ahmed
1000
Muhammad
2000
Note that the root element start and end tags are provided
arrow_forward
Create a MySQL Database called “CSC306Class”. Create three (3) tables in the database called “studentInf”, “IntructorInf”, and “LikedAndDisliked”. Each table should consist of five columns that are relatable to the table name. Insert at least five row of data in each table. The data can be any information as long as it is related to the table name.
If you were able to download and setup an php server on computer. Try to create the database, tables, and rows. Then upload a screenshot and code.
Please help me with the practice problem I have created.
arrow_forward
Write Mysql code
The database has three tables for tracking horse-riding lessons:
Horse with columns:
ID - primary key
RegisteredName
Breed
Height
BirthDate
Student with columns:
ID - primary key
FirstName
LastName
Street
City
State
Zip
Phone
EmailAddress
LessonSchedule with columns:
HorseID - partial primary key, foreign key references Horse(ID)
StudentID - foreign key references Student(ID)
LessonDateTime - partial primary key
Write a SELECT statement to create a lesson schedule with the lesson date/time, horse ID, and the student's first and last names. Order the results in ascending order by lesson date/time, then by horse ID. Unassigned lesson times (student ID is NULL) should not appear in the schedule.
Hint: Perform a join on the Student and LessonSchedule tables, matching the student IDs.
arrow_forward
Web Application Development
arrow_forward
University of Kerbala
College of CS & IT
Information Technology department
First Exam
Time: one hour
Database lab
Q-Design a system for airline reservation database, should have at least tables. In addition to
build schema, the required is:
1- write all instruction's to do this structure.
2- Make new field with titles notes to first table has data type integer.
3- Edit the new field to be character data type.
4- Remove any column from any table.
Good Luck!
arrow_forward
table not copied
arrow_forward
To get credit for this assignment, perform the instructions below and enter the code you get from the instructions below here (Hint: starts with 360)
Instructions
First, create a MySQL database or use an existing database (make sure to use a UTF8 character set, like utf8mb4) and then create a table in the database called "Ages":
CREATE TABLE Ages ( `name` VARCHAR(128), age INTEGER );
Then make sure the table is empty by deleting any rows that you previously inserted, and insert these rows and only these rows with the following commands:
DELETE FROM Ages; INSERT INTO Ages (`name`, age) VALUES ('Deelan', 37); INSERT INTO Ages (`name`, age) VALUES ('Denver', 33); INSERT INTO Ages (`name`, age) VALUES ('Rona', 23); INSERT INTO Ages (`name`, age) VALUES ('Kodi', 29); INSERT INTO Ages (`name`, age) VALUES ('Seaan', 18); Once the inserts are done, run the following SQL command:SELECT sha1(CONCAT(`name`,age)) AS X FROM Ages ORDER BY X; Find the first row in the resulting record set and…
arrow_forward
1-Write the syntax to insert into a relational table called students the address column references an object table called addresses that was created using an address_type.
Other columns exist in the students table, but you are only inserting into the ones below. Aliases used should be the first letter of the table name, eg students would be s, addresses would be a
Relational Table Name
students
attribute
student_id
attribute
surname
attribute
address
arrow_forward
I was hoping you could provide some light on the role that the data dictionary plays in the DBLC method.
arrow_forward
1. The rows in the JOBS table store a minimum and maximum salary allowed for different JOB ID
values. You are asked to write code to ensure that employees' salaries fall in the range allowed for
their job type, for insert and update operations.
arrow_forward
How does indexing work with columns that store JSON data in PostgreSQL?
arrow_forward
What's "metadata"? Metadata in a dataset: Metadata from a result set—useful?
arrow_forward
For this assignment I need to perform the instructions below and enter the code you get from the instructions below here (Hint: starts with 143)
arrow_forward
1.6
Using SQL Server (Not Oracle)
arrow_forward
Write an XML file that describes information of students in a class. The following table has the students’ details:
Name
ID
Ahmed
1000
Muhammad
2000
Note that the root element start and end tags are provided
<class>
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Related Questions
- PHP scriptarrow_forwardWrite Mysql code for: The database has three tables for tracking horse-riding lessons: Horse with columns: ID - primary key RegisteredName Breed Height BirthDate Student with columns: ID - primary key FirstName LastName Street City State Zip Phone EmailAddress LessonSchedule with columns: HorseID - partial primary key, foreign key references Horse(ID) StudentID - foreign key references Student(ID) LessonDateTime - partial primary key Write a SELECT statement to create a lesson schedule for Feb 1, 2020 with the lesson date/time, student's first and last names, and the horse's registered name. Order the results in ascending order by lesson date/time, then by the horse's registered name. Make sure unassigned lesson times (student ID is NULL) appear in the results. Hint: Perform a join on the LessonSchedule, Student, and Horse tables, matching the student IDs and horse IDs.arrow_forwardTable is necessaryarrow_forward
- Write an XML file that describes information of students in a class. The following table has the students' details: Name ID Ahmed 1000 Muhammad 2000 Note that the root element start and end tags are providedarrow_forwardCreate a MySQL Database called “CSC306Class”. Create three (3) tables in the database called “studentInf”, “IntructorInf”, and “LikedAndDisliked”. Each table should consist of five columns that are relatable to the table name. Insert at least five row of data in each table. The data can be any information as long as it is related to the table name. If you were able to download and setup an php server on computer. Try to create the database, tables, and rows. Then upload a screenshot and code. Please help me with the practice problem I have created.arrow_forwardWrite Mysql code The database has three tables for tracking horse-riding lessons: Horse with columns: ID - primary key RegisteredName Breed Height BirthDate Student with columns: ID - primary key FirstName LastName Street City State Zip Phone EmailAddress LessonSchedule with columns: HorseID - partial primary key, foreign key references Horse(ID) StudentID - foreign key references Student(ID) LessonDateTime - partial primary key Write a SELECT statement to create a lesson schedule with the lesson date/time, horse ID, and the student's first and last names. Order the results in ascending order by lesson date/time, then by horse ID. Unassigned lesson times (student ID is NULL) should not appear in the schedule. Hint: Perform a join on the Student and LessonSchedule tables, matching the student IDs.arrow_forward
- Web Application Developmentarrow_forwardUniversity of Kerbala College of CS & IT Information Technology department First Exam Time: one hour Database lab Q-Design a system for airline reservation database, should have at least tables. In addition to build schema, the required is: 1- write all instruction's to do this structure. 2- Make new field with titles notes to first table has data type integer. 3- Edit the new field to be character data type. 4- Remove any column from any table. Good Luck!arrow_forwardtable not copiedarrow_forward
- To get credit for this assignment, perform the instructions below and enter the code you get from the instructions below here (Hint: starts with 360) Instructions First, create a MySQL database or use an existing database (make sure to use a UTF8 character set, like utf8mb4) and then create a table in the database called "Ages": CREATE TABLE Ages ( `name` VARCHAR(128), age INTEGER ); Then make sure the table is empty by deleting any rows that you previously inserted, and insert these rows and only these rows with the following commands: DELETE FROM Ages; INSERT INTO Ages (`name`, age) VALUES ('Deelan', 37); INSERT INTO Ages (`name`, age) VALUES ('Denver', 33); INSERT INTO Ages (`name`, age) VALUES ('Rona', 23); INSERT INTO Ages (`name`, age) VALUES ('Kodi', 29); INSERT INTO Ages (`name`, age) VALUES ('Seaan', 18); Once the inserts are done, run the following SQL command:SELECT sha1(CONCAT(`name`,age)) AS X FROM Ages ORDER BY X; Find the first row in the resulting record set and…arrow_forward1-Write the syntax to insert into a relational table called students the address column references an object table called addresses that was created using an address_type. Other columns exist in the students table, but you are only inserting into the ones below. Aliases used should be the first letter of the table name, eg students would be s, addresses would be a Relational Table Name students attribute student_id attribute surname attribute addressarrow_forwardI was hoping you could provide some light on the role that the data dictionary plays in the DBLC method.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr