AUTO_INCREMENT
featureCREATE TABLE note (
id int AUTO_INCREMENT,
note_id int AUTO_INCREMENT,
title varchar(50),
description varchar(50),
PRIMARY KEY(id, note_id)
);
The query generates the following error:#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
AUTO_INCREMENT
feature to a column that is not selected as a primary key.
If we want to add the feature to a column, we must make it primary keyCREATE TABLE note (
id int AUTO_INCREMENT,
title varchar(50),
description varchar(50)
);
After running the above query, the following error will be generated:#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
The correct syntax of the query after adding primary key to the column id
:CREATE TABLE note (
id int AUTO_INCREMENT,
title varchar(50),
description varchar(50),
PRIMARY KEY (id)
);
console.log('a+very+nice+string'.split('+'));
Result: ["a", "very", "nice", "string"]
Separate each character, including white-space:
const res = "How are you doing today?".split("");
console.log(res);
Result: ["H", "o", "w", " ", "a", "r", "e", " ", "y", "o", "u", " ", "d", "o", "i", "n", "g", " ", "t", "o", "d", "a", "y", "?"]
Use the limit parameter:
const resLimit = "How are you doing today?".split("", 3);
console.log(resLimit);
Result:["H", "o", "w"]
Use a letter as a separator:const resO = "How are you doing today?".split("o" );
console.log(resO);
Result:["H", "w are y", "u d", "ing t", "day?"]notes
if exists.
It will not occur an error if it does not exist, because we are using IF EXISTS
keywordDROP TABLE IF EXISTS notes
The same goes when creating a new table.
It will not cause an error if a table with the same name already exists.
If the table does not exist, it will create one with the specified fields:CREATE TABLE IF NOT EXISTS students (
`id` int(11) NOT NULL,
`first_name` varchar(255) NOT NULL,
`last_name` varchar(255) NOT NULL
) ENGINE=InnoDB;
st
and copies only several fields from students
tableCREATE TABLE st AS
SELECT
id,
first_name AS name,
last_name AS surname
FROM students
grt
and assigns it Hello
SET @grt = 'Hello';
SELECT @grt AS greeting
at signs
- @
.
Shows base directory of MySQLSELECT @@basedir
Shows whether query uses cache or notSELECT @@have_query_cache
Shows what size does query cache haveSELECT @@query_cache_size
...
Shows complete list of system variables with their valuesSHOW VARIABLES
Complete list of system variables using phpmyadmin
: phpmyadmin/server_variables.php