Company: Amazon_data engineer role_22july
Difficulty: medium
Route 53 Active Account Unexpired Domain Report Amazon Route 53, AWS's domain name registration service, requires new reporting functionality. Create a query that returns a list of all active accounts, the number of unexpired domain names they have, and the nearest expiration date later than July 15, 2022 . The result should have the columns username , domains and nearest_expiration , sorted in ascending order by username . Table: accounts Column Data Type Description id SMALLINT Unique id, primary key username VARCHAR(255) AWS account username is_active SMALLINT Account status: 1 = active, 0 = not active Table: domains Column Data Type Description account_id SMALLINT The account that owns the domain ( accounts.id ) name VARCHAR(255) The domain's name expiration_date VARCHAR(19) Expiration date of the domain, as text YYYY-MM-DD Expected Output Return the following columns, in this order: Column Description username AWS account username domains Number of unexpired domains of the account