MySQL-1
MySQL-1
If a table has 1 primary key and 3 candidate key, how many alternate keys
will be in the table.
i) 4 ii) 3 iii)2 iv)1
Sushma created a table named Person with name as char(20) and address as
varchar(40). She inserted a record with “Adithya Varman” and address as
“Vaanam Illam, Anna Nagar IV Street”. State how much bytes would have
been saved for this record.
i)(20,34) ii)(30,40) iii)(14,40) iv)14,34)
(II)(A) Write an SQL command to assign F_id as primary key in the table
named flight
(B)Write an SQL command to remove the column remarks from the table
name customer.
(A)
(i) To display number of different vehicle type from the table vehicle
(ii) To display number of records entered vehicle type wise whose minimum
cost is above 80
(iii)To set the cost as 45 for those vehicles whose cost is not mentioned
(iv) To remove all motor cycle from vehicle
i)
+---------------------+-----------------+
| VTYPE | AVG(COST) |
+----------------------+-----------------+
| CAR | 65.0000 |
| truck | 125.0000 |
| Moter Cycle | NULL |
| SUV | 65.0000 |
| MOTOR CYCLE | NULL |
+----------------------+-----------------+
ii)
+--------------------+----------------------+------------------+
| OWNER | VTYPE | CONTACT |
+---------------------+----------------------+-----------------+
| Prem Sharma | Moter Cycle | 9987654321 |
| PRIYA REDDY | MOTOR CYCLE | 9123456789 |
+---------------------+----------------------+-----------------+
iii)
+---------------+
| COUNT(*) |
+--------------+
|2|
+--------------+
iv)
+-----------------+
| MAX(COST) |
+-----------------+
| 125 |
+-----------------+
i) To display airport name, city, flight id, flight number corresponding flights
whose departure is from delhi
ii) Display the flight details of those flights whose arrival is BOM, MAA or
CCU
iii) To delete all flights whose flight number starts with 6E.
iv) (A) To display Cartesian Product of two tables