230k views
4 votes
1. Write a query in SQL to list the following information of the artists in movie industry. Limit this information to only 5 artists. Sort the information by age descending order. Full name : first name and last name separated by space Age: Current age Address: State that he resides Contact number: Phone number

User Shalena
by
5.6k points

1 Answer

6 votes

Answer:

1) SQL Server

SELECT Top 5 concate(first name,' ',last name) AS Full name, Current age AS Age, state AS Address, Phone number AS Contact number from actor ORDERBY Current age DSC ;

2) MySQL

SELECT concate(first name,' ',last name) AS Full name, Current age AS Age, state AS Address, Phone number AS Contact number from actor ORDERBY Current age DSC limit 5;

Step-by-step explanation:

There two queries first having syntax works fine in SQL server and later with MySQL. All bold faced words are sql keywords. I assumed the tablename is actor as table name is not given if table name is any other replace actor with that name.

User RRC
by
5.4k points