Sponsor Area
Structured Query Language
Consider the following tables CARDEN and CUSTOMER and answer (b) and (c) parts of question:
TABLE: CARDEN
|
Ccode |
CarName |
Make |
Color |
Capacity |
Charges |
|
501 |
A-Star |
Suzuki |
RED |
3 |
14 |
|
503 |
Indigo |
Tata |
SILVER |
3 |
12 |
|
502 |
Innova |
Toyota |
WHITE |
7 |
15 |
|
509 |
SX4 |
Suzuki |
SILVER |
4 |
14 |
TABLE: CUSTOMER
|
CCode |
Cname |
Ccode |
|
1001 |
Hemant Sahu |
501 |
|
1002 |
Raj Lal |
509 |
|
1002 |
Feroza Shah |
503 |
|
1004 |
Ketan Dhal |
502 |
Write SQL commands for the following statements:
- To display the names of all the silver colored
- To display name of car, make and capacity of cars in descending order of their sitting
- To display the highest charges at which a vehicle can be hired from
- To display the customer name and the corresponding name of the cars hired by them
- SELECT CarName FROM carden WHERE Color LIKE 'Silver';
- SELECT CarName,Make,Capacity FROM carden ORDER BY Capacity;
- SELECT MAX(Charges) FROM carden;
- SELECT Cname,CarName FROM carden,customer WHERE carden.Ccode=customer.Ccode;
Some More Questions From Structured Query Language Chapter
Consider the following tables CARDEN and CUSTOMER and answer (b) and (c) parts of question:
TABLE: CARDEN
Ccode
CarName
Make
Color
Capacity
Charges
501
A-Star
Suzuki
RED
3
14
503
Indigo
Tata
SILVER
3
12
502
Innova
Toyota
WHITE
7
15
509
SX4
Suzuki
SILVER
4
14
TABLE: CUSTOMER
CCode
Cname
Ccode
1001
Hemant Sahu
501
1002
Raj Lal
509
1002
Feroza Shah
503
1004
Ketan Dhal
502
Write SQL commands for the following statements:
- To display the names of all the silver colored
- To display name of car, make and capacity of cars in descending order of their sitting
- To display the highest charges at which a vehicle can be hired from
- To display the customer name and the corresponding name of the cars hired by them
Ccode
CarName
Make
Color
Capacity
Charges
501
A-Star
Suzuki
RED
3
14
503
Indigo
Tata
SILVER
3
12
502
Innova
Toyota
WHITE
7
15
509
SX4
Suzuki
SILVER
4
14
CCode
Cname
Ccode
1001
Hemant Sahu
501
1002
Raj Lal
509
1002
Feroza Shah
503
1004
Ketan Dhal
502
Consider the following tables CARDEN and CUSTOMER and answer (b) and (c) parts of question:
TABLE: CARDEN
Ccode
CarName
Make
Color
Capacity
Charges
501
A-Star
Suzuki
RED
3
14
503
Indigo
Tata
SILVER
3
12
502
Innova
Toyota
WHITE
7
15
509
SX4
Suzuki
SILVER
4
14
TABLE: CUSTOMER
CCode
Cname
Ccode
1001
Hemant Sahu
501
1002
Raj Lal
509
1002
Feroza Shah
503
1004
Ketan Dhal
502
Give the output of the following SQL queries:
- SELECT COUNT(DISTINCT Make) FROM CARDEN;
- SELECT MAX(Charges),MIN(Charges) FROM CARDEN;
- SELECT COUNT(*),Make FROM CARDEN;
- SELECT CarName FROM CARDEN WHERE Capacity=4;
Ccode
CarName
Make
Color
Capacity
Charges
501
A-Star
Suzuki
RED
3
14
503
Indigo
Tata
SILVER
3
12
502
Innova
Toyota
WHITE
7
15
509
SX4
Suzuki
SILVER
4
14
CCode
Cname
Ccode
1001
Hemant Sahu
501
1002
Raj Lal
509
1002
Feroza Shah
503
1004
Ketan Dhal
502
Sponsor Area
Mock Test Series
Mock Test Series



