随笔分类 - Database
摘要:SQLSTATE - Wikipedia
阅读全文
摘要:MySQL create table new_table select c1,c2 from old_table [where 1=2] lose index, auto_increment create table new_table like old_table table structure
阅读全文
摘要:DATE: DATETIME: TIMESTAMP: Fractional Seconds:
阅读全文
摘要:https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html CREATE TABLE fractional (c1 TIME(3), c2 DATETIME(3), c3 TIMESTAMP(4));
阅读全文
摘要:https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html CREATE TABLE t1 ( ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMES
阅读全文
摘要:CREATE TABLE tr ( id INT, name VARCHAR(50), purchased DATE ) PARTITION BY RANGE( YEAR(purchased) ) ( PARTITION p0 VALUES LESS THAN (1990), PARTITION p
阅读全文
摘要:行锁 变 表锁: Number 隐式转 String时, 索引所在列失效, 变表锁 String 隐式转 Number时, 索引所在列不失效, 仍为行锁 间隙锁
阅读全文
摘要:select current_date() from dual; select current_time() from dual; select current_timestamp() from dual; select date_add(now,interval 10 minute) from d
阅读全文
摘要:select abs(-5) from dual; select bin(10) from dual; # 转二进制 1010 select hex(100) from dual; select conv(number,from_base,to_base) select ceil(n) select
阅读全文
摘要:select charset(str); # 显示客户端字符集 select charset(field1) from table; # field1字符集 select charset(field2) from table; # field2字符集 concat(str1,str2,...); i
阅读全文
摘要:load data infile 'data.csv' into table project.tbl_data character set utf8mb4 fields terminated by ',' optionally enclosed '"' escaped by '"' lines te
阅读全文
摘要:tar -xf base.tar.gz --directory /data chown -R postgres.postgres /data chown -R 0700 /data sudo -u postgres /usr/lib/postgresql/10/bin/pg_ctl start --
阅读全文
摘要:~/.pgpass hostname:port:database:username:password chmod 0600 ~/.pgpass PGPASSWORD=password psql --host=host --port=5432 --username postgres postgres
阅读全文
摘要:schema: \dnS+ 显示schema drop schema public cascade; create schema public authorization postgres;grant all on schema public to postgres;grant all on sch
阅读全文
摘要:CREATE TABLE vaunt ( id INTEGER PRIMARY KEY, NAME VARCHAR ( 55 ) NOT NULL, PASSWORD VARCHAR ( 55 ) NOT NULL, email VARCHAR ( 55 ), create_time TIMESTA
阅读全文
摘要:select concat('drop table ',table_name,';') from information_schema.tables where table_schema='employees' and table_name rlike '^d.*$' into outfile 'd
阅读全文

浙公网安备 33010602011771号