Mysql的部分常用SQL語句

2022-02-01 16:21:45 字數 364 閱讀 2916

【管理-查詢】

1. 查詢資料庫中,包含有資料記錄的表名

select table_name

from information_schema.tables

where table_schema = '資料庫名稱' and table_rows > 0 ;

2. 查詢當前日期時間前三天資料

select * from 表名 where 時間字段 < (now() + interval-3 day) ;

3. 將指定業務日期 更新為 一周後

update table_name set buss_time = (buss_time + interval-7 day) where id = 1 ;

MySql 常用SQL語句

create database kali use kali show tables create table students sno varchar 10 primary key,sname varchar 10 not null,varchar 2 check in 男 女 age varcha...

常用sql語句(mysql)

給表新增列 sql alter table table name add column col name varchar 255 not null default default value 增加表列,指定格式 sql alter table table name add col name bool...

MySQL常用SQL語句

查詢一張表中的所有資料 sql view plain copy select from table name 查詢一張表中的指定列資料 sql view plain copy select column a,column b from table name 按條件查詢一張表中的所有資料 sql vi...