Created
August 12, 2017 00:40
-
-
Save evandocarmo/41bfbd228571e16626dfd38dc9ab67e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
1. Write a SQL query that returns names and emails of customers whose credit cards are about to get expired (in the next 14 days). Data model looks like this:* | |
1. Table Customer (id, name, address, email) | |
2. Table CustomerCreditCards(id,customer_id, ccnumber, cvs, expirationdate) | |
*/ | |
SELECT name, email FROM Customer | |
INNER JOIN CustomerCreditCards | |
ON Customer.id = CustomerCreditCards.customer_id | |
WHERE DATEDIFF(CustomerCreditCards.expirationdate,NOW()) <= 14; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment