Using Where Conditions
/*
mysql> SELECT Name FROM Student WHERE StudentID = 3;
+-------------+
| Name |
+-------------+
| JJ Harvests |
+-------------+
1 row in set (0.00 sec)
*/
/* Prepare the data */
DROP TABLE Student;
CREATE TABLE Student (
StudentID INT NOT NULL PRIMARY KEY,
Name VARCHAR(50) NOT NULL
)TYPE = InnoDB;
/* Insert data for testing */
INSERT INTO Student (StudentID,Name) VALUES (1,'Joe Wang');
INSERT INTO Student (StudentID,Name) VALUES (2,'Cory But');
INSERT INTO Student (StudentID,Name) VALUES (3,'JJ Harvests');
/* Real command */
SELECT Name FROM Student WHERE StudentID = 3;
Related examples in the same category