Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

? 1. SQL provides the AS keyword, which can be used to assign meaningful column names to the results of queries using the SQL built-in

image text in transcribedimage text in transcribed

image text in transcribedimage text in transcribed

? 1. SQL provides the AS keyword, which can be used to assign meaningful column names to the results of queries using the SQL built-in functions. 2. For a relation schema R (A, B, C, D), if AB -> C and C -> D, then AB is a key. 3. The minimum select statement consists of 3 clauses. 4. In a nested query, the execution starts from the outer query then into the inner ones. 5. Aliases can be specified in query using the keyword As in the select clause or in the from clause. 6. If A->B is a hidden functional dependency then B is a portion of the primary key. 7. A good practice of the DB design process is to normalize relations before the ER designing. 8. The SQL UPDATE operation changes the table structure while leaving the data intact. 9. Having is used to place a constraint on aggregated properties. 10.In the GROUP BY clause, we can put only one attribute. 1. Every Boyce code normal form is in a. First Normal Form b. Second Normal Form C. Third Normal Form d. All the above 2. A functional dependency is a relationship between or among: a. Entities b. Rows C. Attributes d. Tables 3. Insert, Delete and Update queries modify the of a table. a. Rows b. Columns C. Constraints d. Schema 4. Which function we use to find the number of rows in a query result: a. Total b. Sum C. Count d. Number 5. Which of the following is not a SQL aggregate function? a. AVG b. COUNT C. CONCAT d. SUM 6. Which of the following is not a valid SQL data type? a. INTEGER b. VARCHAR PRIMARY d. DATE 7. Which of the following value will match the condition LIKE'_B_: a. XBY b. B c. 183 d. All the above 8. What is the purpose of the SQL operator IN? a. Specifies that the sort order should be increasing b. Used to test if one value appears in a set of values Indicates in which table each field can be found d. Used in the GROUP BY only 9. Which SQL keyword is used to sort the result? a. GROUP BY b. SORT ORDER BY d. SORT BY C. c. Consider the following table and functional dependencies: An agency called Instant Cover supplies part-time/temporary staff to hotels throughout Scotland. The table shown in Figure below lists the time spent by agency staff working at two hotels. The National Insurance Number (NIN) is unique for employee. NIN 113567WD 234111XA 712670YD 113567WD Contract Ne C1024 C1024 hoursPerWeek 16 24 28 16 eName John Smith Diane Hocine Sarah White John Smith hotelNe H25 H25 botellocation Edinburgh Edinburgh Glasgow Glasgow C1025 C1025 H4 H4 NIN -> Name NIN, ContarctNe -> hoursPer Week Contarctde->hotele, botellocation hotelNo -> hotelLocation a. The table is susceptible to update anomalies. Provide examples of insertion, deletion, and modification anomalies. b. Describe and illustrate the process of normalizing the table to 3NF. State any assumptions you make about the data shown in this table. Consider the following relations. The primary keys are underlined while the foreign keys are in italic. Hotel (HNum, Hname, Location) Room (RNum, HNum, Type, View, Price) Booking (ID, HNum, GHum, RNum, DateFrom, DateTo) Guest (GNum, Fname, Lname, Gender, DOB, City) Write the corresponding SQL queries for the below questions 1. List fist name, last name and address of all guests in descending order by First name 2. List the name of the hotels located in Paris or Toulouse. 3. List names of hotels that have rooms booked by Steve Martin 4. List all information about the rooms that has a price below the average price of all single rooms 5. For each Hotel, List the total number of Rooms. 6. Write an SQL query to show all hotels along with the number of booking in there. 7. List the name of guests whose last name contains 'a' 8. List the names of hotels who has no booking in them 9. Find the room number with no booking. 10. Find the highest price and average price of room

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

14-18 Compare the two major types of planning and control tools.

Answered: 1 week ago