SQL

您所在的位置:网站首页 mysql数据乘法 SQL

SQL

2023-04-07 00:11| 来源: 网络整理| 查看: 265

查看database和table结构

SHOW DATABASES; #查看 有哪些数据库show tables from 668shit; #查看 某个数据库内有哪些表desc `kpi_mola干预`; #查看 某个表的内部结构use databaseName; #更换当前使用的数据库#查询表中列的注释信息select * from information_schema.columns where table_schema = 'db' #表所在数据库and table_name = 'tablename' ; #你要查的表 #只查询列名和注释select column_name, column_comment from information_schema.columnswhere table_schema ='db' and table_name = 'tablename' ;#查看表的注释select table_name,table_comment from information_schema.tableswhere table_schema = 'db' and table_name ='tablename'#查看表生成的DDLshow create table table_name;#可以用\G来结尾,使得结果容易阅读;该命令把创建表的DDL显示出来,于是表结构、类型,外键,备注全部显示出来了。

复制

复制表结构:create table table1 like table;复制数据:insert into table1 select * from table


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3