Please select a subject first
Advertisements
Advertisements
______ clause is used with a SELECT statement to display data in a sorted form with respect to a specified column.
Concept: SQL for Data Query
Which function returns the sum of all elements of a list?
Concept: Functions in SQL
Differentiate between CHAR and VARCHAR data types in SQL with appropriate examples.
Concept: Data Types and Constraints in MySQL
Name any two DML commands.
Concept: Data Updation and Deletion
Write the output of the queries (i) to (iv) based on the table, WORKER given below:
TABLE: WORKER
| W_ID | F_NAME | L_NAME | CITY | STATE |
| 102 | SAHIL | KHAN | KANPUR | UTTAR PRADESH |
| 104 | SAMEER | PARIKH | ROOP NAGAR | PUNJAB |
| 105 | MARY | JONES | DELHI | DELHI |
| 106 | MAHIR | SHARMA | SONIPAT | HARYANA |
| 107 | ATHARVA | BHARDWAJ | DELHI | DELHI |
| 108 | VEDA | SHARMA | KANPUR | UTTAR PRADESH |
SELECT F_NAME, CITY FROM WORKER ORDER BY STATE DESC;SELECT DISTINCT (CITY) FROM WORKER;SELECT F_NAME, STATE FROM WORKER WHERE L_NAME LIKE '_HA%';SELECT CITY, COUNT(*) FROM WORKER GROUP BY CITY;
Concept: SQL for Data Query
Write the command to view all databases.
Concept: SQL for Data Definition
Write the outputs of the SQL queries (i) to (iv) based on the relations COMPUTER and SALES given below:
| Table: COMPUTER | ||||
| PROD_ID | PROD_NAME | PRICE | COMPANY | TYPE |
| P001 | MOUSE | 200 | LOGITECH | INPUT |
| P002 | LASER PRINTER | 4000 | CANON | OUTPUT |
| P003 | KEYBOARD | 500 | LOGITECH | INPUT |
| P004 | JOYSTICK | 1000 | IBALL | INPUT |
| P005 | SPEAKER | 1200 | CREATIVE | OUTPUT |
| P006 | DESKET PRINTER | 4300 | CANON | OUTPUT |
| Table: SALES | ||
| PROD_ID | QTY_SOLD | QUARTER |
| P002 | 4 | 1 |
| P003 | 2 | 2 |
| P001 | 3 | 2 |
| P004 | 2 | 1 |
SELECT MIN(PRICE), MAX(PRICE) FROM COMPUTER;SELECT COMPANY, COUNT(*) FROM COMPUTER GROUP BY COMPANY HAVING COUNT(COMPANY) > 1;SELECT PROD_NAME, QTY_SOLD FROM COMPUTER C, SALES S WHERE C.PROD_ID=S.PROD_ID AND TYPE = 'INPUT';SELECT PROD_NAME, COMPANY, QUARTER FROM COMPUTER C, SALES S WHERE C.PROD_ID=S.PROD_ID;
Concept: SQL for Data Query
Name any two DDL commands.
Concept: SQL for Data Definition
The code given below deletes the record from the table employee, which contains the following record structure:
E_code - StringE_name - StringSal - IntegerCity - String
Note the following to establish connectivity between Python and MySQL:
- Username is
root - Password is
root - The table exists in a MySQL database named
emp. - The details
(E_code, E_name, Sal, City)are the attributes of the table.
Write the following statements to complete the code:
Statement 1 – to import the desired library.
Statement 2 – to execute the command that deletes the record with E_code as 'E101'.
Statement 3 – to delete the record permanently from the database. ____________
import ____________ as mysql #Statement1
def delete():
mydb=mysql.connect(host="localhost",use r="root",
passwd="root",database="emp")
mycursor=mydb.cursor()
____________ #Statement 2
____________ #Statement 3
print ("Record deleted") Concept: SQL for Data Definition
The code given below reads the following records from the table employee and displays only those records that have employees coming from the city 'Delhi':
E_code - StringE_name - StringSal - IntegerCity - String
Note the following to establish connectivity between Python and MySQL:
- Username is
root - Password is
root - The table exists in a MySQL database named
emp. - The details
(E_code,E_name,Sal,City)are the attributes of the table.
Write the following statements to complete the code:
Statement 1 - to import the desired library.
Statement 2 - to execute the query that fetches records of the employees/coming from the city ‘Delhi’.
Statement 3 - to read the complete data of the query (rows whose city is Delhi) into the object named details, from the table employee in the database.
import ____________ as mysql #Statement 1
def display():
mydb=mysql.connect(host="localhost",user="root"
passwd="root", database=" emp")
mycursor=mydb.cursor()
____________ #Statement 2
details = ____________ # Statement 3
for i in details:
print (i)Concept: SQL for Data Query
In a table in the MYSQL database, an attribute A of datatype varchar(20) has the value “Keshav”. The attribute B of datatype char(20) has the value “Meenakshi”. How many characters are occupied by attribute A and attribute B?
Concept: Data Types and Constraints in MySQL
Ms Shalini has just created a table named “Employee” containing columns Ename, Department and Salary. After creating the table, she realized that she has forgotten to add a primary key column in the table. Help her in writing an SQL command to add a primary key column EmpId of integer type to the table Employee.
Thereafter, write the command to insert the following record in the table:
EmpId- 999
Ename- Shweta
Department: Production
Salary: 26900Concept: SQL for Data Definition
Consider the table CLUB given below and write the output of the SQL queries that follow.
| CID | CNAME | AGE | GENDER | SPORTS | PAY | DOAPP |
| 5246 | AMRITA | 35 | FEMALE | CHESS | 900 | 2006- 03-27 |
| 4687 | SHYAM | 37 | MALE | CRICKET | 1300 | 2004- 04-15 |
| 1245 | MEENA | 23 | FEMALE | VOLLEYBALL | 1000 | 2007- 06-18 |
| 1622 | AMRIT | 28 | MALE | KARATE | 1000 | 2007- 09-05 |
| 1256 | AMINA | 36 | FEMALE | CHESS | 1100 | 2003- 08-15 |
| 1720 | MANJU | 33 | FEMALE | KARATE | 1250 | 2004- 04-10 |
| 2321 | VIRAT | 35 | MALE | CRICKET | 1050 | 2005- 04-30 |
- SELECT COUNT(DISTINCT SPORTS) FROM CLUB;
- SELECT CNAME, SPORTS FROM CLUB
WHERE DOAPP<"2006-04-30" AND CNAME LIKE "%NA"; - SELECT CNAME, AGE, PAY FROM CLUB WHERE GENDER = "MALE" AND PAY BETWEEN 1000 AND 1200;
Concept: SQL for Data Query
Consider the table Personal given below:
| Table: Personal | ||||
| P_ID | Name | Desig | Salary | Allowance |
| P01 | Rohit | Manager | 89000 | 4800 |
| P02 | Kashish | Clerk | NULL | 1600 |
| P03 | Mahesh | Superviser | 48000 | NULL |
| P04 | Salil | Clerk | 31000 | 1900 |
| P05 | Ravina | Superviser | NULL | 2100 |
Based on the given table, write SQL queries for the following:
- Increase the salary by 5% of personals whose allowance is known.
- Display Name and Total Salary (sum of Salary and Allowance) of all personals. The column heading ‘Total Salary’ should also be displayed.
- Delete the record of Supervisors who have salary greater than 25000.
Concept: SQL for Data Definition
Kabir wants to write a program in Python to insert the following record in the table named Student in MYSQL database,
SCHOOL:
- rno(Roll number) - integer
- name(Name) - string
- DOB (Date of birth) - Date
- Fee - float
Note the following to establish connectivity between Python and MySQL:
- Username - root
- Password - tiger
- Host - localhost
The values of fields rno, name, DOB and fee has to be accepted from the user. Help Kabir to write the program in Python.
Concept: Data Types and Constraints in MySQL
Consider the tables PRODUCT and BRAND given below:
| Table: PRODUCT | ||||
| PCode | PName | UPrice | Rating | BID |
| P01 | Shampoo | 120 | 6 | M03 |
| P02 | Toothpaste | 54 | 8 | M02 |
| P03 | Soap | 25 | 7 | M03 |
| P04 | Toothpaste | 65 | 4 | M04 |
| P05 | Soap | 38 | 5 | M05 |
| P06 | Shampoo | 245 | 6 | M05 |
| Table: BRAND | |
| BID | BName |
| M02 | Dant Kanti |
| M03 | Medimix |
| M04 | Pepsodent |
| M05 | Dove |
Write SQL queries for the following:
- Display product name and brand name from the tables PRODUCT and BRAND.
- Display the structure of the table PRODUCT.
- Display the average rating of Medimix and Dove brands.
- Display the name, price, and rating of products in descending order of rating.
Concept: SQL for Data Query
Zack is working in a database named SPORT, in which he has created a table named “Sports” containing columns SportId, SportName, no_of_players, and category.
After creating the table, he realized that the attribute, category has to be deleted from the table and a new attribute TypeSport of data type string has to be added. This attribute TypeSport cannot be left blank. Help Zack write the commands to complete both the tasks.
Concept: Data Types and Constraints in MySQL
Sartaj has created a table named Student in MYSQL database, SCHOOL:
- rno(Roll number )- integer
- name(Name) - string
- DOB (Date of birth) – Date
- Fee – float
Note the following to establish connectivity between Python and MySQL:
- Username - root
- Password - tiger
- Host - localhost
Sartaj, now wants to display the records of students whose fee is more than 5000. Help Sartaj to write the program in Python.
Concept: Data Types and Constraints in MySQL
Hi-Standard Tech Traj.ning Ltd. is a Mumbai based organization which is expanding its office set-up to Chennai. At Chennai office compound, they are planning to have 3 different blocks for Admin, Training and Accounts related activities. Each block has a number of computers, which are required to be connected in a network for communication, data and resource sharing.
As a network consultant, you have to suggest the best network related solutions for them for issues/problems raised by them in (i) to (iv), as per the distances between various blocks/locations and other given parameters.

Shortest differences between various blocks/locations:
| Admin Block to Accounts Block | 300 Metres |
| Accounts Block to Training Block | 150 Metres |
| Admin Block to Training Block | 200 Metres |
| MUMBAI Head Office to CHENNAI Office | 1300 Km |
The number of computers installed at various blocks is as follows:
| Training Block | 150 |
| Accounts Block | 30 |
| Admin Block | 40 |
1) Suggest the most appropriate block/location to house the SERVER in the CHENNAI office (out of the 3 blocks) to get the best and effective connectivity. Justify your answer.
2) Suggest the best-wired medium and draw the cable layout (Block to Block) to efficiently connect various blocks within the CHENNAI office compound.
3) Suggest a device/software and its placement that would provide data security for the entire network of the CHENNAI office.
4) Suggest a device and the protocol that shall be needed to provide wireless Internet access to all smartphone/laptop users in the CHENNAI office
Concept: Network Devices
Differentiate between packet switching over message switching
Concept: Network Devices
