Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
synchronous_commit = off
Maatkit has become part of Percona Toolkit, and there will be no further development or releases of Maatkit separately from Percona Toolkit.
— Нормальная консоль с autocompleate. Удобство работы.
а вы режим auto-rehash пробовали активировать?
mysql> create schema users;
Query OK, 1 row affected (0.01 sec)
mysql> create table users.users(user_id int);
Query OK, 0 rows affected (0.10 sec)
mysql> insert into users.users values(1);
Query OK, 1 row affected (0.01 sec)
mysql> create schema billing;
Query OK, 1 row affected (0.00 sec)
mysql> create table billing.daily(user_id int, bill int);
Query OK, 0 rows affected (0.07 sec)
mysql> insert into billing.daily values(1,1);
Query OK, 1 row affected (0.01 sec)
mysql> SELECT uu.user_id, bd.bill FROM users.users uu JOIN billing.daily bd ON bd.user_id=uu.user_id WHERE bd.user_id=1;
+---------+------+
| user_id | bill |
+---------+------+
| 1 | 1 |
+---------+------+
1 row in set (0.01 sec)
mysql> grant all on billing.* to billing_user@'%';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all on users.* to users_user@'%';
Query OK, 0 rows affected (0.00 sec)
то в postgress можно сделать так (примерный запрос — возможно с ошбками):
SELECT uu.user_id, bd.bill FROM users.users uu
JOIN billing.daily bd ON bd.user_id=uu.user_id
WHERE user_id=777;
— все названия таблиц, колонок только маленькими буквами.
CREATE TABLE "myBigTable" ( "firstColumn" int ....);SELECT "firstColumn" as "КолоНка Любимая" FROM "схемаНаша"."табличкО";# CREATE INDEX index_companies_users_on_company_id ON companies_users USING btree (company_id);
# CREATE INDEX index_companies_users_on_user_id ON companies_users USING btree (user_id);
# CREATE UNIQUE INDEX index_companies_users_on_company_id_and_user_id ON companies_users USING btree (company_id, user_id);
CREATE TABLE user_bak LIKE user;
BEGIN; -- начинаю транзакцию
UPDATE user_bak SET msg_disabled = 0;
DROP TABLE user;
DROP TABLE automatically commits the current active transaction, unless you use the TEMPORARY keyword.
В PostgreSQL в парсере shift-reduce conflicts нет совсем. Конкретно эта ситуация там разрешена за счет того, что у UNION не может быть LIMIT.
у UNION не может быть LIMIT, либо покайтесь в своей неправоте и примите схиму. Ибо формально в запросе с UNION может быть LIMIT
%pure-parser
%expect 0
mysql> SELECT 'aaa' = 'aaa';
+---------------+
| 'aaa' = 'aaa' |
+---------------+
| 1 |
+---------------+
1 row in set (0.02 sec)
mysql> SELECT 'aaa' = 'aaa ';
+----------------+
| 'aaa' = 'aaa ' |
+----------------+
| 1 |
+----------------+
1 row in set (0.00 sec)
mysql> SELECT 'aaa' = ' aaa';
+----------------+
| 'aaa' = ' aaa' |
+----------------+
| 0 |
+----------------+
1 row in set (0.00 sec)
The length of a CHAR column is fixed to the length that you declare when you create the table. The length can be any value from 0 to 255. When CHAR values are stored, they are right-padded with spaces to the specified length. When CHAR values are retrieved, trailing spaces are removed.
В документации есть такой момент: конечные пробелы в случае =/<> игнорируются.
TIMESTAMP and DATETIME columns have no automatic properties unless they are specified explicitly, with this exception: By default, the first TIMESTAMP column has both DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP if neither is specified explicitly.
Например, в запросе выше смотря на слово LIMIT парсер не может понять, принадлежит этот LIMIT к второму запросу, или ко всему UNION.
... UNION (SELECT ... LIMIT 1)... UNION (SELECT ...) LIMIT 1
Несколько интересных особенностей MySQL