All about Mysql
MYSQL
- mysql -u root -p
- Show database
- Use database
What determines the sequence of operations?
- Order of precedence
- Parentheses
Terms to know
- function
- parameter
- argument
- concatenate
Dont’t equal zero
- where credit_total <> 0
- where credit_total != 0
The order of precedence for compound conditions
- NOT
- AND
- OR
The default sequence for an ascending sort
- null values
- special characters
- numbers
- letters
note
- null values appear first in the sort sequence, even if you are using desc
Don’t count first two
why do we use join?
- same columns in two different tables
To use another database(scheme)
Using self join to get common
We can join N-1 tables to one table
Also we can implicitly join tables not using join
Terms to know about inner join
- join
- join condition
- inner join
- ad hoc relationship
- qualified column name
- table alias
- schema
- self-join
- explicit syntax
- implicit syntax
Outer join retrieve unmatched data as well as matched data from left or right
Combine join
Simpler join using
What is the meaning of natural here?
- Based on common field for example vendor ID
Cross join
- join two table with all possible combinations
- If we have 5 rows in A, 9 rows in B then we will get 45 rows
- It is basically same as select * from A, B
Terms to know about other types of join
- Outer join
- Left outer join
- Right outer join
- Equijoin
- Natural join
- Cross join
- Cartesian product
Rules for a union
- each result set must return the same number of columns
- the corresponding columns in each result set must have compatible data types
- the column names in the final result set are taken from the first select clause
If you want to use full outer join, you have to use union