75% found this document useful (4 votes)
8K views2 pages

MYSQL - Practice Exercise-1 - Final - Questions

The document provides a set of practice SQL exercises using the Sakila and World databases. It includes questions to display tables, table structures, actor data, joins, and to query cities by population and name.

Uploaded by

Prerna Shetty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
75% found this document useful (4 votes)
8K views2 pages

MYSQL - Practice Exercise-1 - Final - Questions

The document provides a set of practice SQL exercises using the Sakila and World databases. It includes questions to display tables, table structures, actor data, joins, and to query cities by population and name.

Uploaded by

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

Practice Exercise – Week 1 – SQL Course

Note – Once MYSQL installation is complete, click on MYSQL workbench option available in
the installed MYSQL to launch MY SQL Workbench.
Once Workbench is launched, connect using the administrator login and password.
Once connected, use the sample database “Sakila” and /or “World” as per the instruction of
the exercises.

Use “Sakila” database for the following questions

Q1 Display all tables available in the database “sakila”

Q2 Display structure of table “actor”. (4 row)

Q3 Display the schema which was used to create table “actor” and view the
complete schema using the viewer. (1 row)

Q4 Display the first and last names of all actors from the table actor. (200
rows)

Q5 Which actors have the last name ‘Johansson’. (3 rows)

Q6 Display the first and last name of each actor in a single column in upper
case letters. Name the column Actor Name. (200 rows)

Q7 You need to find the ID number, first name, and last name of an actor, of
whom you know only the first name, "Joe." What is one query would you use
to obtain this information? (1 row)

Q8 Which last names are not repeated? (66 rows)

Q9 List the last names of actors, as well as how many actors have that last

Q10 Use JOIN to display the first and last names, as well as the address, of
each staff member. Use the tables “staff” and “address”. (2 rows)

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Use “world” database for the following questions

Q1 Display all columns and 10 rows from table “city”.(10 rows)

Q2 Modify the above query to display from row # 16 to 20 with all columns.
(5 rows)

Q3 How many rows are available in the table city. (1 row)-4079.

Q4 Using city table find out which is the most populated city.
('Mumbai (Bombay)', '10500000')

Q5 Using city table find out the least populated city.


('Adamstown', '42')

Q6 Display name of all cities where population is between 670000 to 700000.


(13 rows)

Q7 Find out 10 most populated cities and display them in a decreasing


order i.e. most populated city to appear first.

Q8 Order the data by city name and get first 10 cities from city table.

Q9 Display all the districts of USA where population is greater than


3000000, from city table. (6 rows)

Q10 What is the value of name and population in the rows with ID =5, 23, 432
and 2021. Pl. write a single query to display the same. (4 rows).

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

You might also like