1.9.3 Example 3: Retrieve customer purchases from the customer table and sales history table (3 of 3)
Retrieve the customer ID (USERID), name (NAME), sex (SEX), product code (PUR-CODE), and date of purchase (PUR-DATE) from the sales history table (SALESLIST) and customer table (USERSLIST) for customers who meet either of the following conditions:
-
Male customers who purchased products on or after September 6, 2011
-
Female customers who purchased products on or after September 5, 2011
- Table to search
- Specification example
-
SELECT "SALESLIST"."USERID","NAME","SEX","PUR-CODE","PUR-DATE" FROM "SALESLIST","USERSLIST" WHERE (("PUR-DATE">=DATE'2011-09-06' AND "SEX"='M') OR ("PUR-DATE">=DATE'2011-09-05' AND "SEX"='F')) AND "SALESLIST"."USERID"="USERSLIST"."USERID"
- Retrieval results