Can anyone help me with an SQL statement? (1 Viewer)

sqlnewbie

New member
Local time
Today, 00:58
Joined
May 9, 2014
Messages
2
Hi everyone I am fairly new to SQL, and I am in a database class. I need help on querying this statement "write a sql statement to display the First and Last Name of students having an a in the second position in their first names."

The tables are
Student Student_ID Last_Name First_Name Address Zip Major Class Status 1 Smith James 555 Ohio Road 88888 Business
5 2 Doe Jane 32 3rd Ave 88888 Biology
10 3 Miller Mark 511 Easy streer 88808 Math
5 4 Smith Ty 54 Main Street 88808 Math
3

My SQL statement that I wrote is: select first_name, last_name
FROM STUDENT WHERE FIRST_NAME LIKE'_A'; however, the result just shows last_name and first_name columns with blank rows. Any help is appreciated.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 17:58
Joined
Jan 20, 2009
Messages
12,854
WHERE FIRST_NAME LIKE "*A"
This will show where first names end in A.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:58
Joined
Aug 30, 2003
Messages
36,129
If you want to test the second letter, try the Mid() function. You could also combine the 2 wildcards of ? and *.
 

namliam

The Mailman - AWF VIP
Local time
Today, 09:58
Joined
Aug 11, 2003
Messages
11,695
Your where clause demands the full string to be 2 characters long, any char followed by an A and nothing more...

Try adding a * behind it.
 

Users who are viewing this thread

Top Bottom