Write SQL statements to create the following tables with the given constraints. i) account account_no balance...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write SQL statements to create the following tables with the given constraints. i) account account_no balance char(5) primary key number Not null and cannot be less than 0 ii) customer customer_no char(5) primary key customer_name varchar2(20) Not null customer_city varchar2(10) iii) depositor account_no char(5) customer_no char(5) primary key (account_no, customer_no) Lab Task #02 (Schema Modification): After executing each of these SQL statements execute the command-dese <table_name> to confirm the changes. i. Write SQL statement to add a new attribute 'date of birth' (date type) in customer table. ii. Write SQL statement to drop the attribute 'date of birth' from customer table. iii. Write SQL statement to rename the attribute account_no, customer no from depositor table to a no and e_no, respectively. iv. Write SQL statements to add two foreign key constraints 'depositor_fkl' and 'depositor_fk2' which identifies a_no and c_no as a foreign key. Lab Task # 03 (Inserting Records into Tables): Write appropriate SQL statements to insert the records as shown below. Account Customer ACCOUNT NO BALANCE CUSTOMER NO CUSTOMER_NAME CUSTOMER_CITY A-101 12000 C-101 Alice Dhaka Depositor ANO CNO A-101 C-101 A-102 6000 C-102 Annie Dhaka A-103 C-102 A-103 2500 C-103 Bob Chittagong A-103 C-104 C-104 Charlie Khulna A-102 C-103 Lab Task #04 (Queries): i. Display customer name and customer city only. ii. Display the unique customer city. No repetitions are allowed. iii. Find account numbers with balance more than 7000. iv. Find customer number and customer name who live in Khulna. v. Find customer number and customer name who do not live in Dhaka. vi. Find customer name and customer city who have accounts with balance more than 7000. vii. Find customer name and customer city who have accounts with balance more than 7000 and do not live in Khulna. viii. Find account number and balance for those accounts which belong to a customer with id 'C-102'. ix. Find all account number and balance for those accounts which belong to customers of Dhaka and Khulna city. x. Find the customer who have no accounts. [Result of this query will be empty for this dataset. However, you must write the correct SQL] Write SQL statements to create the following tables with the given constraints. i) account account_no balance char(5) primary key number Not null and cannot be less than 0 ii) customer customer_no char(5) primary key customer_name varchar2(20) Not null customer_city varchar2(10) iii) depositor account_no char(5) customer_no char(5) primary key (account_no, customer_no) Lab Task #02 (Schema Modification): After executing each of these SQL statements execute the command-dese <table_name> to confirm the changes. i. Write SQL statement to add a new attribute 'date of birth' (date type) in customer table. ii. Write SQL statement to drop the attribute 'date of birth' from customer table. iii. Write SQL statement to rename the attribute account_no, customer no from depositor table to a no and e_no, respectively. iv. Write SQL statements to add two foreign key constraints 'depositor_fkl' and 'depositor_fk2' which identifies a_no and c_no as a foreign key. Lab Task # 03 (Inserting Records into Tables): Write appropriate SQL statements to insert the records as shown below. Account Customer ACCOUNT NO BALANCE CUSTOMER NO CUSTOMER_NAME CUSTOMER_CITY A-101 12000 C-101 Alice Dhaka Depositor ANO CNO A-101 C-101 A-102 6000 C-102 Annie Dhaka A-103 C-102 A-103 2500 C-103 Bob Chittagong A-103 C-104 C-104 Charlie Khulna A-102 C-103 Lab Task #04 (Queries): i. Display customer name and customer city only. ii. Display the unique customer city. No repetitions are allowed. iii. Find account numbers with balance more than 7000. iv. Find customer number and customer name who live in Khulna. v. Find customer number and customer name who do not live in Dhaka. vi. Find customer name and customer city who have accounts with balance more than 7000. vii. Find customer name and customer city who have accounts with balance more than 7000 and do not live in Khulna. viii. Find account number and balance for those accounts which belong to a customer with id 'C-102'. ix. Find all account number and balance for those accounts which belong to customers of Dhaka and Khulna city. x. Find the customer who have no accounts. [Result of this query will be empty for this dataset. However, you must write the correct SQL]
Expert Answer:
Answer rating: 100% (QA)
Lab Task 01 Schema Definition Create account Table CREATE TABLE account accountno CHAR5 PRIMARY KEY balance NUMBER NOT NULL CHECK balance 0 This query ... View the full answer
Related Book For
Concepts of Database Management
ISBN: 978-1285427102
8th edition
Authors: Philip J. Pratt, Mary Z. Last
Posted Date:
Students also viewed these programming questions
-
ConAir (CA) commercial airlines company requires you experience in database design and have approached you to assist in the design of their new airline database system. They urgently need to have...
-
There is an XYZ Company, which purchases some parts from vendors to produce some products. It has several departments, marketing sites, and parts supply vendors in the company. 1) For each...
-
What is the output of the following application? A. 5,LONG B. 6,LONG C. 5,null D. 6,null E. The code does not compile. F. The code compiles but throws an exception at runtime. package fly; public...
-
A flat coil is oriented with the plane of its area at right angles to a spatially uniform magnetic field. The magnitude of this field varies with time according to the graph in Fig. 29.42. Sketch a...
-
Coltrane, CPA, is auditing Jang Wholesaling Companys financial statements and is about to perform substantive audit procedures on Jangs trade accounts payable balances. After obtaining an...
-
On March 13, 2009, Juan Mendez Sr. was admitted to a nursing facility. On that day, a doctor employed by the facility determined the father lacked the capacity to give informed consent or make...
-
Transferred-in costs, weighted-average method. Bookworm, Inc., has two departments: printing and binding. Each department has one direct-cost category (direct materials) and one indirect-cost...
-
If your BN CO wants to fund an activity scheduled to occur in November 2023, and today is February 16, 2023, who would be the best person to advise on this activity? S4, S6, or S8? Also, if the CO...
-
What characteristics of a property, plant, and equipment item make it different from other assets, such as accounts receivable or inventory?
-
Molly purchases a motorcycle from Bikes R' Us who has a perfected security interest in the motorcycle until it is paid for. She also borrows $500 from Jake, who is an unsecured creditor. Molly files...
-
Go to the College Board Scholarship Search site:https://bigfuture.collegeboard.org/scholarship-search. Click Start. Then fill in your personal information and click See Results. Browse through the...
-
:0: H OH Hydrogen bonding behavior H3C. CH3 H OH Hydrogen bonding behavior | :0: Hydrogen bonding behavior Hydrogen bonding behavior
-
Supporters of the gold standard for national currencies believe that this precious metal provides: A. An effective hedge against price inflation. B. fixed exchange rates between all currencies. C....
-
Non-self-correcting controls are also known as _____ controls. Question 3 options: 1) Preventive 2) Feedback 3) Performance 4) Sampling
-
An abstract of title for a subject property contains a condensed version of Question 17 options: transaction records from real estate license holders. builder and owner identities. instruments filed...
-
The following data relate to labor cost for production of 4,000 cellular telephones: Actual: 2,670 hrs. at $12.5 Standard: 2,630 hrs. at $12.8 a. Determine the direct labor rate variance, direct...
-
(a) How far away can a human eye distinguish two ear headlights 2.0 m apart? Consider only diffraction effects and assume an eye pupil diameter of 5.0 mm and a wavelength of 550 nm. (b) What is the...
-
Why is increased efficiency an advantage in a distributed database?
-
You have a table that contains the following fields: Member Last Name, Member First Name, Street, City, State, Postal Code, and Membership Fee. There are 75,000 records in the table. What indexes...
-
What are the SQL built-in functions? How do you use them in an SQL query?
-
In the past five years, there have been significant innovations in technology such as smartphones and tablets. Technology companies rely on intellectual property (IP) rights, such as patents,...
-
Respondents Varsity Brands, Inc., Varsity Spirit Corporation, and Varsity Spirit Fashions & Supplies, Inc., design, make, and sell cheerleading uniforms. Respondents have obtained or acquired more...
-
Mr. Tam is the front man for the Asian American dance-rock band The Slants. Mr. Tam named his band The Slants to reclaim and take ownership of Asian stereotypes. The band draws inspiration for its...
Study smarter with the SolutionInn App