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

SQL Training Data

The document contains 80 questions related to SQL queries involving various tables like EmployeeDetail, ProjectDetail, World, Goal, Game, etc. The questions cover concepts like selecting data, filtering on conditions, aggregation, joins, string operations and formatting.

Uploaded by

gk.mobm33
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

SQL Training Data

The document contains 80 questions related to SQL queries involving various tables like EmployeeDetail, ProjectDetail, World, Goal, Game, etc. The questions cover concepts like selecting data, filtering on conditions, aggregation, joins, string operations and formatting.

Uploaded by

gk.mobm33
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

QUESTIONS

1. WAQ to create a database with collation “French_CI_AI” (database name should

be training_db)

2. WAQ to change the collation of a database (training_db) from “French_CI_AI”

3. to “SQL_Latin1_General_CP1_CI_AS”

4. WAQ to Changing the name of a database (training_db) to (maple_training_db)

5. WAQ to create a database snapshot.

6. WAQ to delete a database snapshot.

7. WAQ to drop multiple databases at a time.

8. WAQ to create a table (table name should be tbl_empmaster) with following

columns column name “EID”, data type “int” should not allow null ,

column name “rankid”, data type “smallint” can allow null ,

column name “Salary”, data type “decimal” can allow null ,

column name “doj”, data type “datetime” can allow null ,

column name “dob”,data type “nvarchar(50)” can allow null ,

and EID as a primary key auto increment by 1.

9. WAQ to create a table with age field(column) which allows age values ranging

21 to 35.

10. WAQ to drop a CHECK constraint.

11. WAQ to add column “ADDRESS” with datatype “nvarchar(MAX)” to a

table(tbl_empmaster).

12. WAQ to drop column “ADDRESS” from a table(tbl_empmaster).


13. WAQ to modify column datatype “nvarchar(50)” to “datetime” for “dob” field in

tbl_empmaster.

14. WAQ to alter a table (tbl_empmaster) for adding Foreign key from

(tbl_departmentmaster) .

15. WAQ to drop a Foreign key constraint from a table (tbl_empmaster).

Please Use the EmployeeDetail , ProjectDetail tables

16. Write a query for combine FirstName and LastName and display it as "Name"

(also include white space between first name & last name)

17. Get all employee details from EmployeeDetail table whose "FirstName" contains

'k'

18. Get all employee detail from EmployeeDetail table whose "FirstName" start with

any single character between 'a-p'

19. Get all employee detail from EmployeeDetail table whose "FirstName" not start

with any single character between 'a-p'

20. Get all employee detail from EmployeeDetail table whose "Gender" end with 'le'

and contain 4 letters.

21. Get all unique "Department" from EmployeeDetail table.

22. Get the highest "Salary" from EmployeeDetail table.

23. Show "JoiningDate" in "dd mmm yyyy" format, ex "15 Feb 2013"

24. Get the first name, current date, joiningdate and diff between current date and

joining date in months.

25. Get all employee details from EmployeeDetail table whose joining year is 2013.
26. Get all employee details from EmployeeDetail table whose joining date between

"201301-01" and "2013-12-01".

27. Select all employee detail with First name "Vikas","Ashish", and "Nikhil".

28. Display first name and Gender as M/F.(if male then M, if Female then F)

29. Select second highest salary from "EmployeeDetail" table.

30. Write the query to get the department and department wise total(sum) salary,

display it in ascending order according to salary.

31. Write the query to get the department, total no. of departments, total(sum) salary

with respect to department from "EmployeeDetail" table

32. Get department wise maximum salary from "EmployeeDetail" table order by

salary ascending

33. Write down the query to fetch Project name assign to more than one Employee

34. Get employee name, project name order by firstname from "EmployeeDetail" and

"ProjectDetail" for all employee even they have not assigned project

35. Write down the query to fetch EmployeeName & Project who has assign more

than one project

Please Use World table

36. List each country name where the population is larger than that of 'Russia'.

37. Show the countries in Europe with a per capita GDP greater than 'United

Kingdom'.

38. List the name and continent of countries in the continents containing either

Argentina or Australia. Order by name of the country.


39. Which country has a population that is more than Canada but less than Poland?

Show the name and the population.

40. Which countries have a GDP greater than every country in Europe? [Give the

name only.] (Some countries may have NULL gdp values)

41. Find the largest country (by area) in each continent, show the continent, the name

and the area:

42. List each continent and the name of the country that comes first alphabetically.

43. Find the continents where all countries have a population <= 25000000. Then find

the names of the countries associated with these continents. Show name,

continent and population.

44. Some countries have populations more than three times that of any of their

neighbours (in the same continent). Give the countries and continents.

45. Germany (population 80 million) has the largest population of the countries in

Europe. Austria (population 8.5 million) has 11% of the population of

Germany.Show the name and the population of each country in Europe. Show the

population as a percentage of the population of Germany.

Please Use Goal, Game, eteam tables

46. show the matchid and player name for all goals scored by Germany. To identify

German players, check for: teamid = 'GER'Bottom of For

47. Show id, stadium, team1, team2 for just game 1012

48. Modify it to show the player, teamid, stadium and mdate and for every German

goal.

49. Show the team1, team2 and player for every goal scored by a player called Mario
50. Show player, teamid, coach, gtime for all goals scored in the first 10 minutes

51. List the the dates of the matches and the name of the team in which 'Fernando

Santos' was the team1 coach.

52. List the player for every goal scored in a game where the stadium was 'National

Stadium, Warsaw'

53. Instead show the name of all players who scored a goal against Germany

54. Show teamname and the total number of goals scored.

55. Show the stadium and the number of goals scored in each stadium.

56. For every match involving 'POL', show the matchid, date and the number of goals

scored.

57. For every match where 'GER' scored, show matchid, match date and the number

of goals scored by 'GER'

Please Use Employee, Incentives tables

58. Get First_Name from employee table using alias name “Employee Name”

59. Get First_Name from employee table in upper case

60. Get First_Name from employee table in lower case

61. Get unique DEPARTMENT from employee table

62. Select first 3 characters of FIRST_NAME from EMPLOYEE

63. Get position of 'o' in name 'John' from employee table

64. Get FIRST_NAME from employee table after removing white spaces from right

side

65. Get FIRST_NAME from employee table after removing white spaces from left side

66. Get length of FIRST_NAME from employee table


67. Get First_Name from employee table after replacing 'o' with '$'

68. Get First_Name and Last_Name as single column from employee table separated

by a '_'

69. Get FIRST_NAME ,Joining year,Joining Month and Joining Date from employee

table

70. Get employee details from employee table whose employee name are “John”

and “Roy”

71. Get employee details from employee table whose employee name are not “John”

and “Roy”

72. Get employee details from employee table whose first name starts with 'J'

73. Get employee details from employee table whose first name contains 'o'

74. Get employee details from employee table whose first name ends with 'n'

75. Get employee details from employee table whose first name ends with 'n' and

name contains 4 letters

76. Get employee details from employee table whose first name starts with 'J' and

name contains 4 letters

77. Get employee details from employee table whose Salary in between 500000 and

800000

78. Get employee details from employee table whose joining year is “2013”

79. Get employee details from employee table who joined before January 1st 2013

80.

You might also like