Logical Operators Workbook Question 1 Table name: Pets ID PetName Type 1 Molly Dog 2 Bentley Dog 3 Monica Cat 4 Hammy Hamster Write an SQL query to extract all of the records from the above table. Select* from Pets Question 2 Table name: TVSoaps ID SoapName Channel 1 Eastenders BBC1 2 Coronation Street ITV1 3 Emmerdale Farm ITV1 4 Holby City BBC1 Write an SQL query to extract all of the records from the above table. Select* from TVsoaps Question 3 Table name: Pets ID PetName Type 1 Molly Dog 2 Bentley Dog 3 Monica Cat 4 Hammy Hamster Write an SQL query to extract the records for dogs from the table above. Select* from dog Question 4 Which record ID numbers would have been returned by this query? 1 and 2 Question 5 Write an SQL query to extract the record for Bentley from the Pets table Select* from id 2 Question 6 Table name: TVSoaps ID SoapName Channel 1 Eastenders BBC1 2 Coronation Street ITV1 3 Emmerdale Farm ITV1 4 Holby City BBC1 Write an SQL query to extract the records for BBC1 from the table above. Select* from BBC 1 Question 7 Which record ID numbers would have been returned by this query? 1 AND 4 Question 8 Write an SQL query to extract the record for Eastenders from the table above. Select* from eastenders Question 9 Which record(s) would be extracted if you ran the following SQL query: SELECT * FROM TVSoaps WHERE Channel = ‘BBC2’ Question 10 Table name: Pets ID PetName Type 1 Molly Dog 2 Bentley Dog 3 Monica Cat 4 Hammy Hamster Write an SQL query to extract all of the records which are not dogs. Select* from all except dogs Question 11 Which record IDs would have been returned by this query? 3 and 4 Question 12 Table name: Pets ID PetName Type 1 Molly Dog 2 Bentley Dog 3 Monica Cat 4 Hammy Hamster Write an SQL query to extract all of the records except Monica. Select* from all except monica Question 13 Table name: Pets ID PetName Type 1 Molly Dog 2 Bentley Dog 3 Monica Cat 4 Hammy Hamster Write an SQL query to extract all of the records from this table except ID 4. Select* from all except id 4 Question 14 Table name: TVSoaps ID SoapName Channel 1 Eastenders BBC1 2 Coronation Street ITV1 3 Emmerdale Farm ITV1 4 Holby City BBC1 Write an SQL query to extract all of the records which are not BBC1. Select* from all except BBC1 Question 15 Which record IDs would have been returned by this query? 2 AND 3 Question 16 Table name: TVSoaps ID SoapName Channel 1 Eastenders BBC1 2 Coronation Street ITV1 3 Emmerdale Farm ITV1 4 Holby City BBC1 Write an SQL query to extract all of the records except Holby City. Select* from all except HOLBY CITY Question 17 Table name: TVSoaps ID SoapName Channel 1 Eastenders BBC1 2 Coronation Street ITV1 3 Emmerdale Farm ITV1 4 Holby City BBC1 Write an SQL query to extract all of the records from this table except ID 2. Select* from row ID 2 Question 18 Table name: Pets ID PetName Type Age 1 Molly Dog 1 2 Bentley Dog 4 3 Monica Cat 8 4 Hammy Hamster 2 Write an SQL query to extract all of the records from this table for animals that are older than 3. Select* from all animals older then 3+ Question 19 Which record IDs would have been returned by this query? 2 and 3 Question 20 Table name: Pets ID PetName Type Age 1 Molly Dog 1 2 Bentley Dog 4 3 Monica Cat 8 4 Hammy Hamster 2 Write an SQL query to extract all of the records from this table for animals that are less than 7. Select* from all animals less than 7 Question 21 Which record IDs would have been returned by this query? 1,2 and 4 Question 22 Table name: Pets ID PetName Type Age 1 Molly Dog 1 2 Bentley Dog 4 3 Monica Cat 8 4 Hammy Hamster 2 Write an SQL query to extract all of the records from this table for animals that are 4 years or older. Select* from all animals older then 4+ Question 23 Which record IDs would have been returned by this query? 2 and 3 Question 24 Table name: Pets ID