Database (2) database design
1-Write the relational algebra expressions for the following (using Ç):
branch (branch_name, branch city, assets)
customer (customer_name, customer street, customer city)
loan (loan number, branch_name, amount)
borrower (customer name, loan number)
account (account_number, branch name, balance)
depositor (customer_name, account number)
a) Find the names of all customers who have a loan and an account at bank.
b) Find all customers who have an account from at least the “Downtown” and the “Uptown” branches.
2- University schema
Classroom (building, room number, capacity)
Department (dept name, building, budget)
Course (course id, title, dept_name, credits)
Instructor (ID, name, dept_name, salary)
Section (course id, sec id, semester, year, building, room number, time slot id)
Teaches (ID, course id, sec id, semester, year)
Student (ID, name, dept_name, tot cred)
Takes (ID, course id, sec id, semester, year, grade)
Advisor (student ID, instructor ID)
Time slot (time slot id, day, start time, end time)
Prereq (course id, prereq id)
Write the following queries in SQL, using the university schema
a) Find the names of all students who have taken at least one Comp. Sci. course; make sure there are no duplicate names in the result
b) Increase the salary of each instructor in the IT department by 15%.
c) Insert every student whose tot cred attribute is greater than 75 as an instructor in the same department, with a salary of $15,000.
3- Refer to the university schema used in Q.2 and write the following queries using Nested subqueries.
a) Find the average instructors’ salaries of those departments where the average salary is greater than $50,000. (Hint: use subqueries in the From Clause)
b) Delete all courses that have never been offered (that is, do not occur) in the section relation.
4- Deleting a record can be costly to an organization if not done in the right way. Let us assume you are working as a DBA (database administrator) and you used the delete command without specifying a condition in the where clause. What do you think will happen to the record in the database? And in case a record was deleted, is there a way to recover the lost data? Answer should be in your own words.
6 years ago
10
Answer(0)
other Questions(10)
- mangerial accounting
- Managing Political Risk, Government Relations, and Alliances---------Prof Maurice
- Excel
- Consider the following articles on domestic violence from your module readings: Male Victims of Domestic Violence: A Substantive and Methodological Research Review and Internalized Sexual Minority Stressors and Same-Sex Intimate Partner Violence. In your
- Contemporary Diet and Nutrition
- Nursing research is used to study a dilemma or a problem in nursing. Examine a problem you have seen in...
- Supply and Demand Articles*****Already A++ Rated Tutorial Use as Guide Paper*****
- Business
- FIN515 Finance Short notice Week 6, 13 accoutning problems
- Assignment 2 | Required Assignment 1 | Intercultural Employee Motivation and Rewards