Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write SQL query What is the oldest and newest accounts for this bank? Contaxt He

ID: 3594957 • Letter: W

Question

Write SQL query

What is the oldest and newest accounts for this bank?

Contaxt Help Snippats Query 1 x MIDTERM.Zelada - Schema x MIDTERM Zelada - Schema xSQL File 3 x LearningSQL-MySQL-Script x ACCOUNT x Server Status Client Connections 1SELECT FROM MIDTERM Zelada.ACCOUNT; Users and Privileges Status and System Variables Automatic context help Is disabled. Use the toolbar to manually get help for the current caret position or to toggle Data Import/Restor INSTANCE Filter Rows:Search | Result Grid Edit: g Export/Import: 0 Startup Shutdown A Server Logs ACCOUNT ID AVAIL BALANCE CLOSE DATE LAST ACTIVITY DATE OPEN DATE PENDING BALANCE STATUS CUSTLID OPEN BRANCHLID OPEN EMP ID 2000-01-15 1057.75 Options File 2001-03-12 2258.02 Dashboard Performance Reports Performance Schema Setup 2002-11-23 1057.75 w, | n so41220oso1at 200001-15 50412 ACTIVE : MIDTERM-Zelada Tables 2004-01-12 5000 2001-05 23 3487.19 El ACC,TRANSACTION BRANCH BUSINESS EI CUSTOMER 2002-0930 23575.1 ACTIVE 10 DEPARTMENT29345 5612004 1.42004-0922 9345 56ACTvE 0 ACTIVE 11 ACTIVE 12 ACTIVE 13 EMPLOYEE EI INDIVIDUAL OFFICER PRODUCT Table: ACCOUNT Time Action Duration/Fetch Time int(11) Alle A 130 012924 SELECT FROM MIDTERM ZeladaACCOUNT LIMIT 0, 1000 24 rowls) returnec 0,00033 sec /0.000.. ACCOUNT Query Completed

Explanation / Answer

1) select * from ACCOUNT where OPEN_DATE=(select min(OPEN_DATE) from ACCOUNT);

explanation:initially query on the left side of the equals gets all the records from ACCOUNTS table and it equals the each recored with date value returned by the query on the right side of equals which is obviously the oldest date. So the query gives the output of oldest account.

2) select * from ACCOUNT where OPEN_DATE=(select max(OPEN_DATE) from ACCOUNT);

explanation:initially query on the left side of the equals gets all the records from ACCOUNTS table and it equals the each record with date value returned by the query on the right side of equals which is obviously the newest date. So the query gives the output of newest account.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote