The first value in the output of a SQL query (given below) when run on a table having name “Table-1” is?
SQL Query: SELECT LastName FROM Table-1 WHERE State = "IN" ORDER BY FirstName
| LastName | FirstName | StreetNumber | StreetName | City | State |
|---|---|---|---|---|---|
| Squires | Edwin | 4589 | Shamar Rd. | Upland | IN |
| Rothrock | Paul | 91657 | Carex Ave. | Upland | IN |
| Ramirez | Douglas | 123 | Fake St. | Springfield | IN |
| Peterson | Chris | 4687 | Windthrow Way | Kane | PA |
| Gibson | David | 354 | Bluestem St. | Carbondale | IL |
We are given the query:
SELECT LastName FROM Table-1 WHERE State = "IN" ORDER BY FirstName
Let's filter the table rows where State is "IN":
- Squires, Edwin — IN
- Rothrock, Paul — IN
- Ramirez, Douglas — IN
Now, order these by the FirstName column:
1. Douglas (Ramirez)
2. Edwin (Squires)
3. Paul (Rothrock)
So, the first entry by alphabetical order of FirstName is Douglas, and the corresponding LastName is Ramirez.
Answer: Ramirez