(a) Write the sql syntax to create a table name Client with the following restrictions; Client(cid, cname, address, age, occupation, salary, payment_mode) Where cid is the primary key. cname do not accept null values. Payment_mode accepts only cash or credit entries. The default address is “vacoas". client is at least 25 years old. Salary is above Rs 30000. (b) Consider the schema of Customer table in part(a) and write SQL statements for the following queries. i. Using SQL, write the command to add a new column in the client table with the following data definition; (Column “gender" of char data type and field size of 1). ii. Using SQL, write the command to insert the values in the Client table. cid | address age оссиpation salary Payment_mode gender cname 123 sam vacoas 31 manager 60000 cash m 124 david Пася 38 administrator 45000 credit iii. Write the SQL query to display the cid of all employees. iv. Write the SQL code to list all administrators whose salary is greater than Rs 45000. V. Write the SQL query to set salary of all supervisors to Rs 40 000. vi. Write the SQL query to display details of clients whose names end with character 'e'. vii. Write the SQL code to display details of those clients who come from Vacoas or mahebourg. viii. Write the SQL code to list details of clients in descending order of the salary. ix. Write the SQL code to show details of clients whosere salary is greater than Rs 45000 and age is between 35 and 45.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
(a) Write the sql syntax to create a table name Client with the following restrictions;
Client(cid, cname, address, age, occupation, salary, payment_mode)
Where
cid is the primary key.
cname do not accept null values.
Payment_mode accepts only cash or credit entries.
The default address is “vacoas".
client is at least 25 years old.
Salary is above Rs 30000.
(b) Consider the schema of Customer table in part(a) and write SQL statements for the following queries.
i. Using SQL, write the command to add a new column in the client table with the following data
definition; (Column “gender" of char data type and field size of 1).
ii.
Using SQL, write the command to insert the values in the Client table.
cid
address
age
occupation
salary
Payment_mode gender
cname
123
sam
vacoas
31
manager
60000
cash
m
124
david
flacq
38
administrator 45000
credit
m
iii.
Write the SQL query to display the cid of all employees.
iv.
Write the SQL code to list all administrators whose salary is greater than Rs 45000.
Write the SQL query to set salary of all supervisors to Rs 40 000.
V.
vi. Write the SQL query to display details of clients whose names end with character 'e'.
vii.
Write the SQL code to display details of those clients who come from Vacoas or mahebourg.
viii.
Write the SQL code to list details of clients in descending order of the salary.
ix.
Write the SQL code to show details of clients whosere salary is greater than Rs 45000 and age
is between 35 and 45.
Transcribed Image Text:(a) Write the sql syntax to create a table name Client with the following restrictions; Client(cid, cname, address, age, occupation, salary, payment_mode) Where cid is the primary key. cname do not accept null values. Payment_mode accepts only cash or credit entries. The default address is “vacoas". client is at least 25 years old. Salary is above Rs 30000. (b) Consider the schema of Customer table in part(a) and write SQL statements for the following queries. i. Using SQL, write the command to add a new column in the client table with the following data definition; (Column “gender" of char data type and field size of 1). ii. Using SQL, write the command to insert the values in the Client table. cid address age occupation salary Payment_mode gender cname 123 sam vacoas 31 manager 60000 cash m 124 david flacq 38 administrator 45000 credit m iii. Write the SQL query to display the cid of all employees. iv. Write the SQL code to list all administrators whose salary is greater than Rs 45000. Write the SQL query to set salary of all supervisors to Rs 40 000. V. vi. Write the SQL query to display details of clients whose names end with character 'e'. vii. Write the SQL code to display details of those clients who come from Vacoas or mahebourg. viii. Write the SQL code to list details of clients in descending order of the salary. ix. Write the SQL code to show details of clients whosere salary is greater than Rs 45000 and age is between 35 and 45.
Expert Solution
steps

Step by step

Solved in 3 steps with 8 images

Blurred answer
Knowledge Booster
SQL Query
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education