More SQL Examples |
List all the customers whose names begin with "S".
SELECT contact_id, name FROM contact WHERE name LIKE 'S%'
List all the people who belong to companies whose names begin with "S".
SELECT name, firstname,lastname FROM person, contact WHERE name LIKE 'S%' AND contact.contact_id *= person.contact_id
List all the appointments happening today.
SELECT * FROM appointment WHERE activeDate >= '2002.10.21' AND activeDate < '2002.10.22'
List how many appointments each user has today
SELECT associate_id, count(associate_id) FROM appointment WHERE activeDate >= '2002.10.21' AND activeDate < '2002.10.22' GROUP BY associate_id
Up: OLE-DB Examples Prev: Simple SQL Examples Next: Simple SQL Examples Edit