0% found this document useful (0 votes)
17 views27 pages

CH1

The document contains a series of SQL queries and explanations related to string manipulation, mathematical functions, and data analysis. It includes tasks such as displaying specific characters from strings, rounding numbers, and removing spaces, as well as SQL functions like UCASE and TRIM. Additionally, it presents a scenario involving a clothing shop database and a DataFrame related to a Computer Olympiad, with questions requiring SQL and Python statements for data retrieval and analysis.

Uploaded by

poorani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views27 pages

CH1

The document contains a series of SQL queries and explanations related to string manipulation, mathematical functions, and data analysis. It includes tasks such as displaying specific characters from strings, rounding numbers, and removing spaces, as well as SQL functions like UCASE and TRIM. Additionally, it presents a scenario involving a clothing shop database and a DataFrame related to a Computer Olympiad, with questions requiring SQL and Python statements for data retrieval and analysis.

Uploaded by

poorani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 27

5.

Write suitable SQL query for the following: 5


i. Display 7 characters extracted from 7th left character onwards from the
string ‘INDIA SHINING’.
ii. Display the position of occurrence of string ‘COME’ in the string
‘WELCOME WORLD’.
iii. Round off the value 23.78 to one decimal place.
iv. Display the remainder of 100 divided by 9.
v. Remove all the expected leading and trailing spaces from ‘ USERS
’.

6.
Explain the following SQL functions using suitable examples.
i. UCASE()
ii. TRIM()
iii. MID()
iv. DAYNAME()
v. POWER()

7. Shreya, a database administrator has designed a database for a clothing shop. 1+1+2
Help her by writing answers of the following questions based on the given
table: TABLE: CLOTH

CCODE CNAME SIZE COLOR PRICE DOP


C001 JEANS XL BLUE 990 2022-01-21
C002 T SHIRT M RED 599 2021-12-12
C003 TROUSER M GREY 399 2021-11-10
C004 SAREE FREE GREEN 1299 2019-11-12
C005 KURTI L WHITE 399 2021-12-07
i. Write a query to display cloth names in lower case.
ii. Write a query to display the lowest price of the cloths.
iii. Write a query to count total number of cloths purchased of medium
size.
iv. Write a query to count year wise total number of cloths purchased.

8. Mr. Som, a data analyst has designed the DataFrame df that contains data about
Computer Olympiad with ‘CO1’, ‘CO2’, ‘CO3’, ‘CO4’, ‘CO5’ as indexes
shown below. School
Answer the following questions:Topper
Tot_students First_Runnerup
CO1 PPS 40 32 8
CO2 JPS 30 18 12
CO3 GPS 20 18 2 1+1+2
CO4 MPS 18 10 8
CO5 BPS 28 20 8

A. Predict the output of the following python statement:


i. df.shape
ii. df[2:4]
B. Write Python statement to display the data of Topper column of
indexes CO2 to CO4.
C. Write Python statement to compute and display the difference of data of
Tot_students column and First_Runnerup column of the above given
DataFrame.

You might also like