55
从Key1中获取rand1
SELECT rand1 FROM key_first WHERE key_first.id='1'
数据如下:
查询表名
show tables;
查询字段
select COLUMN_NAME from information_schema.COLUMNS where table_name = 'sdv';
查询字段
//从指定数据库
select COLUMN_NAME from information_schema.COLUMNS where table_name = 'sdv' and table_schema = 'linbx';
查询表的行数
SELECT table_rows FROM information_schema.tables where table_name = 'sdv';
//SELECT table_name,table_rows FROM information_schema.tables;
建议使用这个,上面的information_schema,有时候会不准(在行数很多的时候,我测试是六千多就会不准)
SELECT COUNT(*) FROM key_second;
查询表的列数
SELECT COUNT(*) FROM information_schema.COLUMNS where table_name = 'sdv';
根据id插入update数据
UPDATE u_bdj SET xu_lie_hao='zzz1zz' WHERE u_bdj.pid='123'
SELECT table_rows FROM information_schema.tables where table_name = 'u_bdj'
UPDATE u_bdj SET xu_lie_hao='33333', pid='xxx', uid='www' , name='wx1111111xxww' WHERE id='0'
根据字段A获取其它字段内容
SELECT id FROM correlation WHERE name='aaa999'