SQL Learning
SQL Learning
Select Statement
· Select Statement.
· Select is the most common statement used in SQL, and it
fundamentally allows us to retrieve information from a
table that exists within a database.
· SELECT COLUMN_NAME FROM TABLE_NAME;
· Sql challenes we have a scenerio were we want to retrieve
information form Customer table , its first name , last
name , and email address
· SELECT first_name, last_name,email FROM Customer;
DISTICT KEYWORD
· Sometimes a table contains a column that has duplicate
values, and you may find yourself in a situation
· where you only want to list the unique or distinct values.
· In that column, the distinct keyword can be used to return
only two distinct values in a column.
· SELECT DISTICT column FROM table;
· Sometimes to clarify which column distinct is being applied
to.
· You could also add in parentheses for clarity.
· SELECT DISTICT(column) FROM table;
· So note that distinct on a column works with or without
parentheses.
· name choice
· ansu reading
· ansu watching movie
COUNT
Q.2) Could you give them the description for the movie Outlaw
Hanky?
SELECT decription FROM film WHERE movie='Outlaw Hanky';
ORDERBY
BETWEEN
IN
· you want to check for multiple possible value options, for
example, if a user's
· name shows up in a list of known names.
· So instead of having to write a bunch of or statements
such as Name is equal to David or Name is equal
· to Claire or name is equal to Zach, we could use the
operator to just create a condition that quickly
· checks to see if a value is included in a list of multiple
options
· general syntax