Informatics Practices
Rahul, who works as a database designer, has developed a database for a bookshop. This database includes a table BOOK whose column (attribute) names are mentioned below:
BCODE: Shows the unique code for each book.
TITLE: Indicates the book’s title.
AUTHOR: Specifies the author’s name.
PRICE: Lists the cost of the book.
Table: BOOK
BCODE | TITLE | AUTHOR | PRICE |
---|---|---|---|
B001 | MIDNIGHT'S CHILDREN | SALMAN RUSHDIE | 500 |
B002 | THE GOD OF SMALL THINGS | ARUNDHATI ROY | 450 |
B003 | A SUITABLE BOY | VIKRAM SETH | 600 |
B004 | THE WHITE TIGER | ARAVIND ADIGA | 399 |
B005 | TRAIN TO PAKISTAN | KHUSHWANT SINGH | 350 |
I. Write SQL query to display book titles in lowercase.
II. Write SQL query to display the highest price among the books.
III. Write SQL query to display the number of characters in each book title.
IV. Write SQL query to display the Book Code and Price sorted by Price in descending order.
SQL Queries
3 Likes
Answer
I.
SELECT LOWER(TITLE)
FROM BOOK;
II.
SELECT MAX(PRICE)
FROM BOOK;
III.
SELECT LENGTH(TITLE)
FROM BOOK;
IV.
SELECT BCODE, PRICE
FROM BOOK
ORDER BY PRICE DESC;
Answered By
2 Likes
Related Questions
Consider the following tables:
Table 1:
ATHLETE, which stores AthleteID, Name, Country. The table displays basic information of the athletes.
Table 2:
MEDALS, which stores AthleteID, Sport, and Medals. The table displays the number of medals won by each athlete in their respective sports.
Table: ATHLETE
AthleteID Name COUNTRY 101 Arjun INDIA 102 Priya INDIA 103 Asif UAE 104 Rozy USA 105 David DENMARK Table: MEDALS
AthleteID Sport Medals 101 Swimming 8 102 Track 3 103 Gymnastics 5 104 Swimming 2 105 Track 6 Write appropriate SQL queries for the following:
I. Display the sports-wise total number of medals won.
II. Display the names of all the Indian athletes in uppercase.
III. Display the athlete name along with their corresponding sports
During a practical exam, a student Ankita has to fill in the blanks in a Python program that generates a bar chart. This bar chart represents the number of books read by four students in one month.
Student Name Books Read Karan 12 Lina 9 Raj 5 Simran 3 Help Ankita to complete the code.
import _____ as plt #Statement-1 students = ['Karan', 'Lina', 'Raj', 'Simran'] books_read = [12, 9, 5, 3] plt.bar( students, _____, label='Books Read') #Statement-2 plt.xlabel('Student Name') plt._____('Books Read') #Statement-3 plt.legend() plt.title('_____') #Statement-4 plt.show()
I. Write the suitable code for the import statement in the blank space in the line marked as Statement-1.
II. Refer to the graph shown above and fill in the blank in Statement-2 with suitable Python code.
III. Fill in the blank in Statement-3 with the name of the function to set the label on the y-axis.
IV. Refer the graph shown above and fill the blank in Statement-4 with suitable Chart Title.
Dr. Kavita has created a database for a hospital's pharmacy. The database includes a table named MEDICINE whose column (attribute) names are mentioned below:
MID: Shows the unique code for each medicine.
MED_NAME: Specifies the medicine name.
SUPP_CITY: Specifies the city where the supplier is located.
STOCK: Indicates the quantity of medicine available.
DEL_DATE: Specifies the date when the medicine was delivered.
Table: MEDICINE
MID MED_NAME SUPP_CITY STOCK DEL_DATE M01 PARACETAMOL MUMBAI 200 2023-06-15 M02 AMOXICILLIN KOLKATA 50 2023-03-21 M03 COUGH SYRUP BENGALURU 120 2023-02-10 M04 INSULIN CHENNAI 135 2023-01-25 M05 IBUPROFEN AHMEDABAD 30 2023-04-05 Write the output of the following SQL Queries.
I. Select LENGTH(MED_NAME) from MEDICINE where STOCK > 100;
II. Select MED_NAME from MEDICINE where month(DEL_DATE) = 4;
III. Select MED_NAME from MEDICINE where STOCK between 120 and 200;
IV. Select max(DEL_DATE) from MEDICINE;
ABC Pvt. Ltd., a multinational technology company, is looking to establish its Indian Head Office in Bengaluru, and a regional office branch in Lucknow. The Bengaluru head office will be organized into four departments: HR, FINANCE, TECHNICAL, AND SUPPORT. As a network engineer, you have to propose solutions for various queries listed from I to V.
The shortest distances between the departments/offices are as follows:
HR TO FINANCE 65 M HR TO TECHNICAL 80 M HR TO SUPPORT 70 M FINANCE TO TECHNICAL 60 M FINANCE TO SUPPORT 75 M TECHNICAL TO SUPPORT 50 M BENGALURU OFFICE TO LUCKNOW 1900 KM The number of computers in each department/office is as follows:
HR 175 FINANCE 35 TECHNICAL 50 SUPPORT 15 LUCKNOW OFFICE 40 I. Suggest the most suitable department in the Bengaluru Office Setup, to install the server. Also, give a reason to justify your suggested location.
II. Draw a suitable cable layout of wired network connectivity between the departments in the Bengaluru Office.
III. Which networking device would you suggest the company to purchase to interconnect all the computers within a department in Bengaluru Office?
IV. The company is considering establishing a network connection between its Bengaluru Head Office and Lucknow regional office. Which type of network—LAN, MAN, or WAN—will be created? Justify your answer.
V. The company plans to develop an interactive website that will enable its employees to monitor their performance after login. Would you recommend a static or dynamic website, and why?