MySQL查询数据库中表名或字段名】的更多相关文章

查询数据库中所有表名 select table_name from information_schema.tables where table_schema='csdb' and table_type='base table'; 查询指定数据库中指定表的所有字段名 select column_name from information_schema.columns where table_schema='csdb' and table_name='users';…
SELECT TABLE_NAME '表名',TABLE_SCHEMA '数据库名',ORDINAL_POSITION '顺序',COLUMN_NAME '字段',DATA_TYPE '类型' ,CHARACTER_OCTET_LENGTH '字节长',IF(COLUMN_KEY='PRI',"√","") '主键',IF(EXTRA='auto_increment',"√","") '自增长' ,IF(IS_NULLABLE…
select COLUMN_NAME from information_schema.`COLUMNS`        -- 这行不变,照抄 where TABLE_SCHEMA = 'xerp'                     -- 数据库名xerp and TABLE_NAME = 'sdb_ome_orders'                 -- 表名sdb_ome_orders…
SELECT t.name AS table_name, c.name AS column_name FROM XOIFundData.sys.tables AS t INNER JOIN XOIFundData.sys.columns c ON t.OBJECT_ID = c.OBJECT_ID WHERE c.name LIKE '%RoleInPortfolio%'…
1.建表语句sys_user CREATE TABLE `sys_user` ( `id` varchar(32) NOT NULL COMMENT '编号', `dept_id` varchar(32) DEFAULT NULL COMMENT '部门', `login_name` varchar(50) NOT NULL COMMENT '登录名', `password` varchar(100) NOT NULL COMMENT '密码', `salt` varchar(20) NOT N…
#======================================================================= #查询表信息 select table_name, table_comment, create_time, update_time from information_schema.tables where table_schema = (select database()); #=====================================…
1,查询方法 public static List<Map<String, String>> getColumnInfoByTableName(String databaseName, String databaseUserName, String databaseUserPassword, String tableName){ //指定表 // String sql = "SELECT TABLE_NAME, column_name, DATA_TYPE, COLUMN…
oracle初学者一般会遇到这个问题.   用navicat可视化创建了表,可是就是不能查到!   后来发现②语句可以查询到 ①select * from user; 但是,我们如果给user加上双引号就可以查到了! ②select * from "user"; 难道oracle跟mysql等不同,查询时候一定要加双引号?那这样不是很麻烦!于是经过查找资料得出如下结论: 1.oracle表和字段是有大小写的区别.oracle默认是大写,如果我们用双引号括起来的就区分大小写,如果没有,系…
-- 获得存储过程创建语句 select o.xtype,o.name,cm.text from syscomments cm inner join sysobjects o on o.id=cm.id where xtype ='p' order by o.xtype,o.name,cm.text -- 获得视图程创建语句 select o.xtype,o.name,cm.text from syscomments cm inner join sysobjects o on o.id=cm.i…
通常需要查询某个字段来自于哪张表,在navicat中没有直接查哪些表有指定字段名的功能,只能用sql来查. 1.(按字段名查表)查询哪些表有指定字段名(比如查字段名article_id)的SQL: SELECT * FROM information_schema.COLUMNS WHERE COLUMN_NAME='article_id'; 或者 SELECT table_name, column_name FROM information_schema.columns WHERE column…