DeAngelo Cortes
DeAngelo Cortes

Reputation: 1

Clarification on database architecture question

I'm working on a quiz for this internship and one question is worded strangely. I'm hoping that one of you could help me find clarification.

Context: I've just created a flat-file table (database), and added 4 columns (UserId,firstname,lastname,email). I filled each column with 15 rows of made-up data.

The question states "Query all rows in the firstname column that start with the letter B and ordered by the lastname column in descending order."

I'm not sure what they're asking for, does this make sense to you?

Upvotes: 0

Views: 61

Answers (2)

Hichem BOUSSETTA
Hichem BOUSSETTA

Reputation: 1857

The query consists in retrieving first names and last names of rows where the firstname starts with the letter B, and then to order the resulting set using the lastname field in descending order.

The query in sql would be like:

SELECT firstname, lastname FROM users WHERE firstname LIKE 'B%' ORDER BY lastname DESC;

Upvotes: 2

Triston Wasik
Triston Wasik

Reputation: 56

The question is asking you to query the table, selecting the firstname column and all data that starts with the letter 'B'. And then ordered by the lastname. It's a fairly basic query:

SELECT t.firstname
FROM tablename t
WHERE t.firstname like 'B%'
ORDER BY t.lastname DESC;

EDIT: I did forget the DESC;

Upvotes: 3

Related Questions