DATABASE SYSTEM CONCEPTS (LOOSELEAF)
7th Edition
ISBN: 9781260515046
Author: SILBERSCHATZ
Publisher: MCG
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
thumb_up100%
Chapter 3, Problem 30E
Explanation of Solution
Explanation:
- For numeric values it will always be zero. But when there is a null value the answer will be undefined.
- When there is any instant with value equal to null then the answer will be undefined which is not equal to zero...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
TRUE OR FALSE
In the Relational Data Model, Referential Integrity Constraint is a special kind/case of Foreign Key Constraint.
Multiple Inheritance happens when a class has more than one sub-class. This problem can be observed in Programming Languages as well.
Given two relations named A and B, if we q-JOIN A and B, the maximum number of attributes in the result relation could be (the number of attributes of A) times(*) the number of attributes of B).
* in an SQL SELECT statement means “all the tuples”.
In relational algebra, Cartesian Product (X) can be implemented using the q-JOIN operator. Cartesian Product ISA q-JOIN where q-condition always evaluates to true.
SQL is based on Predicate Calculus. A query in SQL always specifies what should be included in the query result.
(d) Write an SQL statement, using the inner join construct, that will, for the lecturer John Smith, list in alphabetical order the students taking any module which he teaches.
(e) What information does the output from the following SQL query provide?
SELECT Lecturer, COUNT(DISTINCT Student)
FROM class INNER JOIN staff
ON class.Module = staff.Module
WHERE Grade < 40
GROUP BY Lecturer;
(f) Write an SQL query which would obtain the following information: for each lecturer, what is the average grade obtained by students across all of the modules which they have taught?
2) Write SQL query that returns the Name of ALL employees (based on EMP_LNAME and EMP_FNAME in EMPLOYEE table, call this EMP_NAME), Gender of ALL employees (based on EMP_TITLE in EMPLOYEE table, call this EMP_NAME), and Pilot ratings if any (PIL_RATINGS in PILOT table).
Output:
EMP_NAME
EMP_GENDER
Rhett VanDam
M
John Lange
M
Jeanine Duzak
F
Chapter 3 Solutions
DATABASE SYSTEM CONCEPTS (LOOSELEAF)
Ch. 3 - Prob. 1PECh. 3 - Prob. 2PECh. 3 - Prob. 3PECh. 3 -
Suppose that we have a relation marks(ID, score)...Ch. 3 - Suppose that we have a relation marks(ID, score)...Ch. 3 -
The SQL like operator is case sensitive (in most...Ch. 3 - Prob. 7PECh. 3 - Prob. 8PECh. 3 - Prob. 9PECh. 3 - Prob. 10PE
Ch. 3 - Prob. 11ECh. 3 - Prob. 12ECh. 3 - Prob. 13ECh. 3 -
Consider the insurance database of Figure 3.17,...Ch. 3 - Prob. 15ECh. 3 - Prob. 16ECh. 3 - Prob. 17ECh. 3 - Prob. 18ECh. 3 -
List two reasons why null values might be...Ch. 3 - Prob. 20ECh. 3 - Prob. 21ECh. 3 - Prob. 22ECh. 3 - Prob. 23ECh. 3 - Prob. 24ECh. 3 - Prob. 25ECh. 3 - Prob. 26ECh. 3 - Using the university schema, write an SQL query to...Ch. 3 - Prob. 28ECh. 3 - Prob. 29ECh. 3 - Prob. 30ECh. 3 - Prob. 31ECh. 3 - Prob. 32ECh. 3 - Prob. 33ECh. 3 - Prob. 34ECh. 3 - Prob. 35E
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Given the database schema R(A, B, C), and a relation r on the schema R, write an SQL query to test whether the functional dependency B → C holds on relation r. Also write an SQL assertion that enforces the functional dependency. Assume that no null values are present. (Although part of the SQL standard, such assertions are not supported by any database implementation currently.)arrow_forwardThis question is related to the Database:- Suppose you are creating a database for a library management system. Explain how you would make a table for the "books" entity and insert some sample data, and then alter the table to add a new column for the "authorID" attribute and update "authorID" with some data. Finally, make a SQL query to retrieve all the books that were published after the year 2000. Note that this book schema has several columns, including "book_id" as the primary key, "title", "authorN", "publisher", "publication_year", "isbn", "language", and "num_pages". It also includes "available" column that is set to "true" by default and can be used to track the availability of the book. Please don't use handwriting...arrow_forwardWhat is the output of an operation that begins with the execution of a Cartesian product of student and adviser and then continues with a selection operation on the result using the predicate s id = ID? Using the symbolic notation of relational algebra, this query may be expressed as s id=ID if it is given in that format (student advisor).arrow_forward
- Consider the following SQL query that seeks to find a list of titles of all coursestaught in Spring 2017 along with the name of the instructor.select name, titlefrom instructor natural join teaches natural join section natural join coursewhere semester = 'Spring' and year = 2017What is wrong with this query?arrow_forwardThe following SQL for a Point of Sale database for a grocery store is not properly constructed. As result, when student attempts to populate the tables, it gives a foreign key constraint fail error. Modify the SQL so that it models the depicted schema and follows the following constraints: They is a one-to-many relationship between the salesdetails.SalesNumber andsales.SalesNumber fields. There is a one-to-many relationship between the products.prodid and salesdetails.prodid fields. There is to be a delete constraint on the product.prodid field a record in the product table should not be allowed to be deleted if they exist a matching prodid in the salesdetails table. Primary and foreign keys should be implemented in the appropriate tables. Referential Integrity should be enforce at the database level, where appropriate for example, if a sales record is deleted all associated records in the saledetails table should be deleted as well, etc. CREATE TABLE `products` ( `number`…arrow_forwardWrite SQL queries for the designed database which will return: - All people on the same flight - All planes on the same destination - If the sum of all cargo weight on the plane is under a threshold.arrow_forward
- Write a SQL trigger to carryout the following action: If an account is deleted, then write a trigger to delete thedependent tuple(s) from the depositor table for every owner of the deleted account. Notethat there may be jointly-owned bank accounts. In other words, you are to write a triggerthat performs the exact action of an ON DELETE CASCADE clause of a FOREIGNKEY CONSTRAINT. You must submit both your trigger function definition, and yourtrigger definitionarrow_forwardConsider the library database of Figure 3.20. Write the following queries in SQL.Find the average number of books borrowed per member. Take into account that if a member does not borrow any books, then that member does not appear in the borrowed relation at all, but that member still counts in the average.arrow_forwardModify the recursive query in Figure 5.16 to define a relationprereq_depth(course_id, prereq_id, depth) where the attribute depth indicates how many levels of intermediate prerequisites there are between the course and the prerequisite. Direct prerequisites havea depth of 0. Note that a prerequisite course may have multiple depths and thusmay appear more than once.arrow_forward
- Take the university schema SQL query: select avg(salary) - (sum(salary)/count(*)) from teacher Since the average of a set of numbers is the sum divided by the number, this query should return 0. Figure 2.1's instructor relation illustrates this. However, that relation can have non-zero results. Give an example and explain why the result is not zero.arrow_forwardConsider the following query using the tumbling window operator: select item, System.Timestamp as window end, sum(amount) from order timestamp by datetime group by itemid, tumblingwindow(hour, 1). Give an equivalent query using normal SQL constructs, without using the tumblingwindow operator. You can assume that the timestamp can be converted to an integervalue that represents the number of seconds elapsed since (say) midnight, January 1,1970, using the function to_ seconds(timestamp). You can also assume that the usualarithmetic functions are available, along with the function floor(a) which returns thelargest integer ≤a.arrow_forwardJust return SQL code/query with proper functions for each of the following. No output needed. Database Schema: Beers(name, manf)Bars(name,addr,license)Drinkers(name,addr,phone)Likes(drinker, beer)Sells(bar,beer,price)Frequents(drinker, bar) 1. Find all distinct drinkers whose phone numbers come from area code 917 and who like Budweiser or Bud (synonim!) 2. What beers does Mike like? 3. Which town has the most drinkers? 4. What bars are frequented by drinkers from that town (3)? 5. Provide all bars which serve beers that Mike likes 6. Who likes at least one same beer that Joe or Mike like? 7. All bars which sell at least one beer which is liked by at least one drinker who frequents these bars 8. Drinkers who like some beers sold by Caravan bar 9. Bars which sell Budweiser and are frequented by some drinkers who like Budweiser 10. Bars which are frequented by Mike and Steve 11. Drinker who like at least two beers that Mike likes 12. Bars which sell at least 3 beers that Mike likes (do…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781285196145Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos CoronelPublisher:Cengage Learning
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning