SQL Homework 2.2
SQL Homework 2.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:
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?