SQL quiz questions

SQL interview questions

  • 1.

    Which of the followings are the types of locks in SQL Server?

    1. Shared locks

    2. Exclusive locks

    3. Schema locks

    4. All of the above

    Answer
  • 2.

    What is OLTP stands for?

    1. Online Transaction Processing

    2. Offline Transaction Processing

    3. Ontime Transaction Program

    4. Online Timebound Processing

    Answer
  • 3.

    What is the difference between Primary key and Unique key?

    1. Primary key doesn’t allow null value whereas unique key allows multiple null values

    2. Primary key allows one null value whereas unique key doesn’t allow null value.

    3. Primary key doesn’t allow null value whereas unique key allows one null value.

    4. Primary key allows one null value whereas unique key allows multiple null values.

    Answer
  • 4.

    What is RAID stands for?

    1. Reduce Array of Independent Disks

    2. Redundant Array of Independent Disks

    3. Redundant Automatic Individual Durable

    4. Redundancy Accelerator Independent Disks

    Answer
  • 5.

    How many types of indexes in SQL server?

    1. Integer and string

    2. Unique and non-unique

    3. Clustered and Nonclustered

    4. None of the above

    Answer
  • 6.

    What are indexes?

    1. Index speed up the data retrieval

    2. Index stores large number of integer values

    3. Index minimize the data redundancy

    4. None of the above.

    Answer
  • 7.

    What is the correct order of query operators in a SQL query?

    1. SELECT -> FROM -> OUTER -> WHERE

    2. FROM -> OUTER -> WHERE -> ON

    3. SELECT -> FROM -> WHERE -> OUTER

    4. FROM -> OUTER -> GROUP BY -> WHERE

    Answer
  • 8.

    A column that automatically generates numeric values is called __________.

    1. Unique column

    2. Integer column

    3. Identity column

    4. Candidate column

    Answer
  • 9.

    A table can have more than one combination of columns that uniquely identify the row in a table; each combination is called_________.

    1. Foreign Key

    2. Primary key

    3. Composite Key

    4. Candidate Key

    Answer
  • 10.

    What is Primary Key?

    1. Primary keys are unique names of a table.

    2. Primary keys are integer ids in a table rows.

    3. Primary keys are unique identifiers for each row in a table.

    4. None of the above.

    Answer
  • 11.

    What is ACID stands for?

    1. Atomic, Cryptic, Independent, Durable

    2. Atomicity, Consistency, Isolation, Durability

    3. Automatic, Concurrent, Isolation, Durability

    4. Atomicity, Consistency, Isolation, Decoupled

    Answer
  • 12.

    What is ACID stands for?

    1. Atomic, Cryptic, Independent, Durable

    2. Atomicity, Consistency, Isolation, Durability

    3. Automatic, Concurrent, Isolation, Durability

    4. Atomicity, Consistency, Isolation, Decoupled

    Answer
  • 13.

    What is normalization?

    1. It is a set of database design rules to minimize redundancy.

    2. It is a set of rules to normalize database transactions.

    3. It is a set of rules to improve database performance.

    4. None of the above

    Answer
  • 14.

    Which of the following query would display all the students whose first name starts with the character ‘A’?

    STUDENTS(student_code, first_name, last_name, email, 
             phone_no, date_of_birth, honours_subject, percentage_of_marks);

     

    1. select first_name from students where first_name like ‘A%’;

       

    2. select first_name from students where first_name like ‘%A’;

       

    3. select first_name from students where first_name like ‘%A%’;

       

    4. select first_name from students where first_name like ‘A’;

       

    Answer
  • 15.

    You want to find the stadium where player 'Dimitris Salpingidis' scored. Select the JOIN condition to use:

    game
    id mdate stadium team1 team2
    1001 8 June 2012 National Stadium, Warsaw POL GRE
    1002 8 June 2012 Stadion Miejski (Wroclaw) RUS CZE
    1003 12 June 2012 Stadion Miejski (Wroclaw) GRE CZE
    1004 12 June 2012 National Stadium, Warsaw POL RUS
    ...
    goal
    matchid teamid player gtime
    1001 POL Robert Lewandowski 17
    1001 GRE Dimitris Salpingidis 51
    1002 RUS Alan Dzagoev 15
    1001 RUS Roman Pavlyuchenko 82
    ...
    eteam
    id teamname coach
    POL Poland Franciszek Smuda
    RUS Russia Dick Advocaat
    CZE Czech Republic Michal Bilek
    GRE Greece Fernando Santos
    ...
    1. eteam JOIN goal ON (teamid=id)
    2. eteam JOIN game ON (id=team1)
    3. eteam JOIN game ON (id=team2)
    4. game  JOIN goal ON (id=matchid)
    5. game  JOIN goal ON (team1=teamid OR team2=teamid)
    Answer
  • 16.

    You want to find the stadium where player 'Dimitris Salpingidis' scored. Select the JOIN condition to use:

    game
    id mdate stadium team1 team2
    1001 8 June 2012 National Stadium, Warsaw POL GRE
    1002 8 June 2012 Stadion Miejski (Wroclaw) RUS CZE
    1003 12 June 2012 Stadion Miejski (Wroclaw) GRE CZE
    1004 12 June 2012 National Stadium, Warsaw POL RUS
    ...
    goal
    matchid teamid player gtime
    1001 POL Robert Lewandowski 17
    1001 GRE Dimitris Salpingidis 51
    1002 RUS Alan Dzagoev 15
    1001 RUS Roman Pavlyuchenko 82
    ...
    eteam
    id teamname coach
    POL Poland Franciszek Smuda
    RUS Russia Dick Advocaat
    CZE Czech Republic Michal Bilek
    GRE Greece Fernando Santos
    ...
    1. eteam JOIN goal ON (teamid=id)
    2. eteam JOIN game ON (id=team1)
    3. eteam JOIN game ON (id=team2)
    4. game  JOIN goal ON (id=matchid)
    5. game  JOIN goal ON (team1=teamid OR team2=teamid)
    Answer
  • 17.

    Select the statement that shows the name and population density of the country with the largest population

    bbc
    name region area population gdp
    Afghanistan South Asia 652225 26000000  
    Albania Europe 28728 3200000 6656000000
    Algeria Middle East 2400000 32900000 75012000000
    Andorra Europe 468 64000  
    ...
    1. SELECT name, MAX (population) FROM bbc WHERE population / (SELECT area FROM bbc)

       

    2. SELECT name, density AS population/area FROM bbc WHERE population = MAX(population)

       

    3. SELECT name, population/area AS density FROM bbc WHERE population = (SELECT MAX(population) FROM bbc)

       

    4. SELECT name, population/area AS density FROM bbc WHERE population > (SELECT MAX(population) FROM bbc)

       

    5. SELECT name, density AS population/area FROM bbc WHERE population = (SELECT MAX(population) FROM bbc)

       

    Answer
  • 18.

    Select the code which would show the year when neither a Physics or Chemistry award was given

    nobel
    yr subject winner
    1960 Chemistry Willard F. Libby
    1960 Literature Saint-John Perse
    1960 Medicine Sir Frank Macfarlane Burnet
    1960 Medicine Peter Medawar
    1960 Physics Donald A. Glaser
    1960 Peace Albert Lutuli
    ...
    1. SELECT yr FROM nobel
       WHERE subject NOT IN(SELECT yr 
                              FROM nobel
                             WHERE subject IN ('Chemistry','Physics'))

       

    2. SELECT yr FROM nobel
       WHERE subject NOT IN(SELECT subject 
                              FROM nobel
                             WHERE subject IN ('Chemistry','Physics'))

       

    3. SELECT yr FROM nobel
       WHERE yr NOT IN(SELECT yr 
                         FROM nobel
                       WHERE subject IN ('Chemistry','Physics'))

       

    4. SELECT yr FROM nobel
       WHERE yr NOT IN(SELECT subject
                       FROM nobel
                      WHERE subject IN ('Chemistry','Physics'))

       

    5. SELECT yr FROM subject
       WHERE yr NOT IN (SELECT yr
                          FROM nobel
                         WHERE subject IN ('Chemistry','Physics'))

       

    Answer
  • 19.

    Select the code which gives the name of countries beginning with U

    world
    name continent area population gdp
    Afghanistan South Asia 652225 26000000  
    Albania Europe 28728 3200000 6656000000
    Algeria Middle East 2400000 32900000 75012000000
    Andorra Europe 468 64000  
    Brazil South America 8550000 182800000 564852000000
    Colombia South America 1140000 45600000  
    Nauru Asia-Pacific 21 9900  
    Uzbekistan Central Asia 447000 26000000  
    ...
    1. SELECT name
        FROM world
       WHERE name
       BEGIN WITH U

       

    2. SELECT name
        FROM world
       WHERE name LIKE '%U'

       

    3. SELECT name
        FROM world
       WHERE name LIKE '%u%'

       

    4. SELECT name
        FROM world
       WHERE name LIKE U

       

    5. SELECT name
        FROM world
       WHERE name LIKE 'U%'

       

    Answer
  • 20.

    Select the code that shows the population density of China, Australia, Nigeria and France

    1. SELECT name, area/population
      FROM world WHERE name LIKE ('China', 'Nigeria', 'France', 'Australia')

       

    2. SELECT name, area/population
      FROM world WHERE name IN ('China', 'Nigeria', 'France', 'Australia')

       

    3. SELECT name, population/area
        FROM world
       WHERE name IN ('China', 'Nigeria', 'France', 'Australia')

       

    4. SELECT name, population
        FROM world
       WHERE name IN ('China', 'Nigeria', 'France', 'Australia')

       

    5. SELECT name, population/area
        FROM world
       WHERE name LIKE ('China', 'Nigeria', 'France', 'Australia')

       

    Answer

© 2017 QuizBucket.org