随笔分类 -  Database

摘要:SQLSTATE - Wikipedia 阅读全文
posted @ 2023-05-26 16:34 ascertain 阅读(18) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2023-04-30 14:11 ascertain 阅读(72) 评论(0) 推荐(0)
摘要:DATE: DATETIME: TIMESTAMP: Fractional Seconds: 阅读全文
posted @ 2022-07-26 23:18 ascertain 阅读(29) 评论(0) 推荐(0)
摘要:https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html CREATE TABLE fractional (c1 TIME(3), c2 DATETIME(3), c3 TIMESTAMP(4)); 阅读全文
posted @ 2022-07-26 22:28 ascertain 阅读(55) 评论(0) 推荐(0)
摘要:https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html CREATE TABLE t1 ( ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMES 阅读全文
posted @ 2022-07-26 22:20 ascertain 阅读(31) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2022-05-09 13:01 ascertain 阅读(31) 评论(0) 推荐(0)
摘要:CREATE TABLE tr ( id INT, name VARCHAR(50), purchased DATE ) PARTITION BY RANGE( YEAR(purchased) ) ( PARTITION p0 VALUES LESS THAN (1990), PARTITION p 阅读全文
posted @ 2022-05-07 15:32 ascertain 阅读(45) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2022-04-26 17:08 ascertain 阅读(30) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2022-04-23 12:39 ascertain 阅读(41) 评论(0) 推荐(0)
摘要:行锁 变 表锁: Number 隐式转 String时, 索引所在列失效, 变表锁 String 隐式转 Number时, 索引所在列不失效, 仍为行锁 间隙锁 阅读全文
posted @ 2022-04-19 21:03 ascertain 阅读(43) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2022-04-16 21:35 ascertain 阅读(381) 评论(0) 推荐(0)
摘要:select current_date() from dual; select current_time() from dual; select current_timestamp() from dual; select date_add(now,interval 10 minute) from d 阅读全文
posted @ 2022-04-05 15:03 ascertain 阅读(36) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2022-04-05 14:23 ascertain 阅读(35) 评论(0) 推荐(0)
摘要:select charset(str); # 显示客户端字符集 select charset(field1) from table; # field1字符集 select charset(field2) from table; # field2字符集 concat(str1,str2,...); i 阅读全文
posted @ 2022-04-05 14:09 ascertain 阅读(37) 评论(0) 推荐(0)
摘要:load data infile 'data.csv' into table project.tbl_data character set utf8mb4 fields terminated by ',' optionally enclosed '"' escaped by '"' lines te 阅读全文
posted @ 2022-02-16 11:43 ascertain 阅读(82) 评论(0) 推荐(0)
摘要: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 -- 阅读全文
posted @ 2022-02-14 10:39 ascertain 阅读(52) 评论(0) 推荐(0)
摘要:~/.pgpass hostname:port:database:username:password chmod 0600 ~/.pgpass PGPASSWORD=password psql --host=host --port=5432 --username postgres postgres 阅读全文
posted @ 2022-02-10 19:58 ascertain 阅读(36) 评论(0) 推荐(0)
摘要:schema: \dnS+ 显示schema drop schema public cascade; create schema public authorization postgres;grant all on schema public to postgres;grant all on sch 阅读全文
posted @ 2021-07-02 17:55 ascertain 阅读(107) 评论(0) 推荐(0)
摘要:CREATE TABLE vaunt ( id INTEGER PRIMARY KEY, NAME VARCHAR ( 55 ) NOT NULL, PASSWORD VARCHAR ( 55 ) NOT NULL, email VARCHAR ( 55 ), create_time TIMESTA 阅读全文
posted @ 2021-05-18 11:12 ascertain 阅读(85) 评论(0) 推荐(0)
摘要:select concat('drop table ',table_name,';') from information_schema.tables where table_schema='employees' and table_name rlike '^d.*$' into outfile 'd 阅读全文
posted @ 2021-05-14 12:21 ascertain 阅读(197) 评论(0) 推荐(0)