EXPLAIN
provides detailed information about the query result.
One of the information that EXPLAIN
gives us is how many rows will be affected after running the queryEXPLAIN UPDATE students SET mail = 'email@gmail.com' WHERE id > 39
Note: EXPLAIN
works with the following statements: SELECT
, DELETE
, INSERT
, REPLACE
, UPDATE
USE university
For example we can list all columns from any of the table inside the selected database without specifying it.
MySQL will know that we mean already the selected databaseSHOW COLUMNS FROM students
DESCRIBE students
Note: the query above is alternative and shortcut of SHOW COLUMNS FROM students
students
table that is in the university
databaseSHOW COLUMNS FROM university.students
Another method to specify a database when listing columns from a tableSHOW COLUMNS FROM students IN university
SHOW COLUMNS FROM students
Shortcut of the query above is DESCRIBE
DESCRIBE students
UniversityDB
SHOW TABLES FROM UniversityDB
SHOW DATABASES
The following query is a synonym of the above query.
Both of them list all the databases on the MySQL host:SHOW SCHEMAS
UNION DISTINCT
combines the two results and removes duplicatesSELECT *
FROM students
WHERE id < 10
UNION DISTINCT
SELECT *
FROM students
WHERE id > 5
The query is equivalent to the above query because DISTINCT
is the default behaviorSELECT *
FROM students
WHERE id < 10
UNION
SELECT *
FROM students
WHERE id > 5
Object
const taskObjects = {
task: 'code',
date: 'today',
repeat: true
}
console .log(taskObjects)
//{task: "code", date: "today", repeat: true}
More "traditional" key/value
Easier to write and access values with . and [ ]
Use when you need to include Functions
(methods)
Use when working with JSON (can convert to map)
Maps
const taskMaps = new Map( [
['task', 'code'],
['date', 'today'],
[false, 'start coding!'],
]);
console .log(taskMaps)
//{"task" => "code", "date" => "today", false => "start coding!"}
Better performance
Keys can have any data type
Easy to iterate
Easy to compute size
Use when you simply need to map key to values
Use when you need key that are not
strings