Given the table, what SQL statement would display the records where the LastName field is "Duck" and the date in the BirthDate field is greater than 01/01/1950?
Given the table, what SQL statement would display the records where the LastName field is "Duck" and the date in the BirthDate field is greater than 01/01/1950?
Assuming the name of the table in question is "myTable":
select
*
from mytable
where lastname = 'Duck'
and birthdate > '1950.01.01'
Tested command in MySQL 5.5.
Note: Whenever possible, I recommend formatting the command. For extended commands this custom is essential to avoid wrong constructions and to facilitate maintenance.
SELECT * FROM table WHERE LastName = 'Duck' AND BirthDate > DATE('1950-01-01');
Where table is the name of the table. Note that *
will show all fields, if you want something specific, replace *
with the desired field name.
Note that the date format in the command must be the same as the BirthDate field format.