0% found this document useful (0 votes)
16 views

SQL Homework 2.2

The document contains questions about querying data from SQL tables. It includes questions about selecting columns, filtering on conditions, aggregating data, manipulating string values, and sorting results.

Uploaded by

Shylender Naga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

SQL Homework 2.2

The document contains questions about querying data from SQL tables. It includes questions about selecting columns, filtering on conditions, aggregating data, manipulating string values, and sorting results.

Uploaded by

Shylender Naga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

SQL Homework 2.

2
Unless specified, use any table to script your query as needed.

1. Query all columns for all American cities in the CITY table with populations larger than

100000. The CountryCode for America is USA. The CITY table is described as follows:

2. Please use the below table for next set of questions.


Unless specified, use any table to script your query as needed.

A. Display the population of Algeria


B. Display the continent of the country Angola
C. What is the population of Albania?
D. Show the population of Albania, Algeria and Andorra.
E. Display the countries with population ranging from 78115 to 25500100
F. Write a code which shows the countries that end with the letter A or L
G. What is the output of below query?

SELECT name, area*2 FROM world WHERE population = 78115

H. Display the countries with an area larger than 50000 and a population smaller than
10000000
I. Write a code which would reveal the name and population of countries in Europe and
Asia
3. Please use the below table for next set of questions.
Unless specified, use any table to script your query as needed.

A. Write a SQL code which shows the name of winner's names beginning with C
and ending in N
B. Write a SQL code that shows how many Chemistry awards were given between
1950 and 1960
C. Display all the winners who belong to subject Medicine in upper case
D. Display the first five character of winners from Chemistry
E. Display subject in lower case and winner with first letter as capital.
F. Add a new column called winner_location to the table noble
G. Change the length of the column winner to varchar2(50)
H. Change the data type of column yr from string to number
I. Delete the column newly added in question ‘F.’ to the table Nobel
(winner_location).
4. Please use the below table (Workers) for next set of questions.
Unless specified, use any table to script your query as needed.

A. What is an SQL query for fetching the unique values of the column
DEPARTMENT from the WORKER table?
B. Write an SQL query for printing the first three characters of the column
FIRST_NAME.
C. What is an SQL query for finding the position of the alphabet (‘A’) in the
FIRST_NAME column of Ayushi.
D. What is an SQL Query for printing the FIRST_NAME from Worker Table after
the removal of white spaces from right side.
E. Write an SQL query for printing the FIRST_NAME after replacing ‘A’ with ‘a’.
F. What is an SQL query for printing the FIRST_NAME and LAST_NAME into a
column named COMPLETE_NAME? (A space char should be used)
G. What is an SQL query for printing all details of the worker table which ordered
by FIRST_NAME ascending?
H. Write an SQL query for printing all details of the worker table which ordered
by FIRST_NAME ascending and the DEPARTMENT in descending
I. What is an SQL query printing all details of workers excluding the first names
of ‘NIHARIKA’ and ‘PRIYANSHA’
J. What is an SQL Query for printing the details of the workers whose
FIRST_NAME ends with ‘H’ and contains six alphabets?

You might also like