Programming techniques Flashcards
What would the SQL statement look like if the Name, Surname, School and Gender fields were required from the StudentInformation table, with a search requirement for only students with M
SELECT StudentInformation.Name, StudentInformation.Surname, StudentInformation.School, StudentInformation.Gender
FROM StudentInformation
WHERE StudentInformation.Gender = ‘M’
What would the SQL statement look like if the Name, HouseName, StreetNumber and Gender fields were required from the InformationOfStudents table, with a search requirement for only students with F and a street number of 1 to 10
SELECT InformationOfStudents.Name, InformationOfStudents.HouseName, InformationOfStudents.StreetNumber, InformationOfStudents.Gender
FROM InformationOfStudents
WHERE InformationOfStudents.Gender = ‘F’ AND InformationOfStudents.StreetNumber >= 1 OR InformationOfStudents.StreetNumber <= 10
What would the SQL statement look like if the Name, Surname, HouseName and Gender fields were required from the StudentInformation table, with a search requirement for only students without M or F, and a house name containing ‘ant’
SELECT StudentInformation.Name, StudentInformation.Surname, StudentInformation.HouseName, StudentInformation.Gender
FROM StudentInformation
WHERE NOT StudentInformation.Gender = ‘M’ AND NOT StudentInformation.Gender = ‘F’ AND StudentInformation.HouseName LIKE ‘ant’
What would the SQL statement look like if all the fields were required from the InformationOfStudents table, with a search requirement for only students with a house number of 8 or a house number of 2
SELECT *
FROM InformationOfStudents
WHERE InformationOfStudents.HouseNumber = 2 OR InformationOfStudents.HouseNumber = 8