Can anyone help me with an SQL statement?

sqlnewbie

New member
Local time
Yesterday, 16:18
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.
 
WHERE FIRST_NAME LIKE "*A"
This will show where first names end in A.
 
If you want to test the second letter, try the Mid() function. You could also combine the 2 wildcards of ? and *.
 
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

Back
Top Bottom