MySQL Document
MySQL Document
JOINS:
INNER JOINS:
It selects all rows from both the tables as long as the condition satisfies.
LEFT JOINS:
The joins returns all the rows of the table on the left side of the join and matching rows for the table
on the right side of join.
RIGHT JOINS:
The joins returns all the rows of the table on the right side of the join and matching rows for the
table on the left side of join.
FULL JOINS:
It selects both the LEFT JOIN and RIGHT JOIN.
• BEFORE INSERT
• AFTER INSERT
• BEFORE UPDATE
• AFTER UPDATE
• BEFORE DELETE
• AFTER DELETE
UNION:
UNION ALL:
Returns all rows from the tables meeting the Query.
MINUS:
Returns all di.stinct rows selected by first query but not second query.
INTERSECT:
Intersection of both the queries.
DELETE:
• Delete command is used to delete a row in a table.
• You can rollback data after using delete statement.
• It is a DML command.
• It is a slower than truncate.
TRUNCATE:
CHAR:
VARCHAR:
ROLLBACK:
CONSTRAINTS:
o NOT NULL
o CHECK
o DEFAULT
o PRIMARY KEY
o AUTO_INCREMENT
o UNIQUE
o INDEX
o ENUM
o FOREIGN KEY
1.NOTNULl:
);
2.UNIQUE:
All values in column - ➔ different
Name varchar(255)
);
3. PRIMARY KEY:
A table can have ONE Primary key, but can have MANY unique constraints.
PRIMARY KEY(ID)
);
4. FOREIGN KEY:
To maintain integrity of data
Dep_id int,
REFERENCES DEPARTMENT(Oep_ld
);
S.CHECK:
);
AUTO_INREMENT:
► If you want to increase the id by default without providing id value, we have to use
AUTO_INCREMENT
ENUM:
Default:
INDEX:
► This constraint allows us to create and retrieve values from the table very quickly and easily.
An index can be created using one or more than one column.
► It assigns a ROWID for each row in that way they were inserted into the table
► CREATE INDEX idx_name ON gender (name);
HAVING:
HAVING Clause is used to filter the rec.ords from the groups based on the given condition in the
HAVING Clause.