178k views
3 votes
Using data from the BITS database, define a view named TopLevelClient. It consists of the number, name, address, balance, and credit limit of all clients with credit limits that are greater than or equal to $10,000.

(a) Using SQL, write the view definition for TopLevelClient.



(b) Write an SQL query to retrieve the number and name of all customers as well as the difference between their credit limit and balance in the TopLevelClient.



(c) Convert the query you wrote in (b) to the query that the DBMS will actually execute.

User Lalyos
by
6.1k points

1 Answer

4 votes

Answer:

Check the explanation

Step-by-step explanation:

a) Consider the following SQL query to create a view TopLevelCust

Query: Create View TopLevelCust AS Select CustomerNum, CustomerName, Street, City, State, PostalCode, Balance, Creditlimit From Customer Where Creditlimit P= 10000,

  • In order to create a view for TopLevelCust, it is required to replace viewname with TopLevelCust
  • select Clause is used to retrieve stored records from the table o CustomerNum, CustomerName, Street, City, State, PostalCode, Balance and Creditlimit are the attribute name
  • from clause specifies one or more table from where records. be retrieved o Customer is the table name
  • where clause is used in SQL query to retrieve only those records that satisfy the specified condition
  • CreditlLimit>=10000 is the specified condition to retrieve the information from table.
User Coren
by
5.7k points