SELECT STATEMENT

Probably the most used word in SQL is SELECT. It is the keyword that signals that information is either going to be extracted from the database or a function. The syntax of a simple SELECT statement:

SELECT column_name(s)
FROM table_name
WHERE column_name = 'value'

This will extract all of information in the column name where the row has a value in the column name indicated by WHERE. The information will be presented in the form of a table. For example we have the following table:

idnamedescrbookauthor
1Jane Porter5ft 2in, Blue EyesTarzanBourroughs
2Scarlett O'Hara5ft 4in, green eyesGone With the WindMitchell
3Rhett Butler6ft 2in, Blue EyesGone With the WindMitchell
4Natasha Rostov5ft 3in Brown EyesWar and PeaceTolstoy
SELECT id, name, book WHERE author = 'Mitchell'

This statement will yield:

idnamebook
2Scarlett O'HaraGone With the Wind
3Rhett ButlerGone With the Wind

< PRIMARY KEY Constraint | MySQL SELECT CASE >

Interesting Fact:

MySQL is the most commonly used database application in the world.


Send notes in disappearing ink!

Interesting Pages