Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get specific row, knowing the primary key value?

Tags:

sql

This is probably very easy question for you sql gurus, but I never used sql before.

If the table "Person" has 3 rows : Name (primary key), Age and City, I know I can get all rows like this :

SELECT * FROM Person;

But if the table looks like this :

Name   Age   City
-------------------
A       2     NY
B       4     BE
C       6     PA

What sql command do I have to use to get (for example) the 2nd row? I know the Name is B.

like image 914
BЈовић Avatar asked Nov 19 '10 08:11

BЈовић


1 Answers

SELECT * FROM Person WHERE Name = 'B';

This solves this particular problem, but you can visit w3schools sql tutorial for the starting.

like image 56
taskinoor Avatar answered Sep 22 '22 02:09

taskinoor