informix查询表结构方法有多种,可以通过系统信息表查询,也可以通过系统功能查询
查询系统表存储信息步骤:
登录数据库
dbaccess
xxxdb
;
执行查询语句
SELECT
c.colname[1,20],
c.coltype,
c.collength
FROM
syscolumns
c,
systables
t
WHERE
c.tabid
=
t.tabid
AND
t.tabname
=
'xxxTable';
通过系统提供的命令功能查询:
dbaccess
-
info
查询表信息
dbschema命令导出表结构
Ⅱ 如何通过sql 查看表的结构
在查询分析器中用SQL语句
Ⅲ 如何通过sql查看表的结构
在查询分析器中用SQL语句
可输入以下编码进行查看
1.
sp_help
tablename
(tablename是你要查看表结构的表名)
2.
select
*
from
information_schema.columns
where
table_name=你要查的表名
3.
初级:使用管理工具SSMS
右侧对象树展开即可
4.
中级:sp_HelpText
表名
5.
高级:用SQL查询系统元数据
Ⅳ 显示数据库的结构应使用的命令是(VFP)
打开数据差基库的命令是:open
database
数据库名.
修改数据库的命高燃令虚念谨是:modify
database
数据库名.
你输入的是datebase,错了一个字母,当然不能识别了
Ⅳ mysql中查询数据库中表名称和结构的sql语句是什么啊啊
TABLE 语句
具体语法:TABLE table_name [ORDER BY column_name] [LIMIT number [OFFSET number]]
其实从语法上看,可以排序,也可以过滤记录集,不过比较简单,没有 SELECT 那么强大。
示例 1
简单的建一张很小的表 y1,记录数为 10 条。表 t1,插入 10 条记录
mysql-(ytt/3305)->create table t1 (r1 int,r2 int);
Query OK, 0 rows affected (0.02 sec)
mysql-(ytt/3305)->insert into t1
with recursive aa(a,b) as (
select 1,1
union all
select a+1,ceil(rand()*20) from aa where a < 10
) select * from aa;
Query OK, 10 rows affected (0.00 sec)
Records: 10 Duplicates: 0 Warnings: 0
- 简单全表扫描mysql-(ytt/3305)->select * from t1;+------+------+| r1 | r2 |+------+------+| 1 | 1 || 2 | 9 || 3 | 9 || 4 | 17 || 5 | 17 || 6 | 16 || 7 | 6 || 8 | 1 || 9 | 10 || 10 | 3 |+------+------+10 rows in set (0.00 sec)
- TABLE 结果mysql-(ytt/3305)->table t1;+------+------+| r1 | r2 |+------+------+| 1 | 1 || 2 | 9 || 3 | 9 || 4 | 17 || 5 | 17 || 6 | 16 || 7 | 6 || 8 | 1 || 9 | 10 || 10 | 3 |+------+------+10 rows in set (0.00 sec)
- 看下 table 的执行计划mysql-(ytt/3305)->explain table t1 order by r1 limit 2G*************************** 1. row *************************** id: 1 select_type: SIMPLE table: t1 partitions: NULL type: ALLpossible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 10 filtered: 100.00 Extra: Using filesort1 row in set, 1 warning (0.00 sec)
- 其实可以看到 TABLE 内部被 MySQL 转换为 SELECT 了。mysql-(ytt/3305)->show warningsG*************************** 1. row *************************** Level: Note Code: 1003Message: /* select#1 */ select `ytt`.`t1`.`r1` AS `r1`,`ytt`.`t1`.`r2` AS `r2` from `ytt`.`t1` order by `ytt`.`t1`.`r1` limit 21 row in set (0.00 sec)
- 那其实从上面简单的例子可以看到 TABLE 在内部被转成了普通的 SELECT 来处理。示例 2应用于子查询里的子表。这里要注意,内表的字段数量必须和外表过滤的字段数量一致。克隆表 t1 结构mysql-(ytt/3305)->create table t2 like t1;Query OK, 0 rows affected (0.02 sec)
- 克隆表 t1 数据mysql-(ytt/3305)->insert into t2 table t1;Query OK, 10 rows affected (0.00 sec)Records: 10 Duplicates: 0 Warnings: 0
- table t1 被当做内表,表 t1 有两个字段,必须同时满足 t2 检索时过滤的字段也是两个。mysql-(ytt/3305)->select * from t2 where (r1,r2) in (table t1);+------+------+| r1 | r2 |+------+------+| 1 | 1 || 2 | 9 || 3 | 9 || 4 | 17 || 5 | 17 || 6 | 16 || 7 | 6 || 8 | 1 || 9 | 10 || 10 | 3 |+------+------+10 rows in set (0.00 sec)
- 注意:这里如果过滤的字段数量和子表数量不一致,则会报错。
Ⅵ MSSQL 显示表结构(字段名 数据类型 长度)的系统存储过程是什么
试试下面的语句SELECT
表名=case when a.colorder=1 then d.name else '' end,
表说明=case when a.colorder=1 then isnull(f.value,'') else '' end,
字段序号=a.colorder,
字段名=a.name,
标识=case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then '√'else '' end,
主键=case when exists(SELECT 1 FROM sysobjects where xtype='PK' and name in (
SELECT name FROM sysindexes WHERE indid in(
SELECT indid FROM sysindexkeys WHERE id = a.id AND colid=a.colid
))) then '√' else '' end,
类型=b.name,
占用字节数=a.length,
长度=COLUMNPROPERTY(a.id,a.name,'PRECISION'),
小数位数=isnull(COLUMNPROPERTY(a.id,a.name,'Scale'),0),
允许空=case when a.isnullable=1 then '√'else '' end,
默认值=isnull(e.text,''),
字段说明=isnull(g.[value],'')
FROM syscolumns a
left join systypes b on a.xusertype=b.xusertype
inner join sysobjects d on a.id=d.id and d.xtype='U' and d.name <>'dtproperties'
left join syscomments e on a.cdefault=e.id
left join sysproperties g on a.id=g.id and a.colid=g.smallid
left join sysproperties f on d.id=f.id and f.smallid=0
--where d.name='TWebInfo' --如果只查询指定表,加上此条件
order by a.id,a.colorder
Ⅶ plsql怎么看表结构
方式一:
按住ctrl键不放,鼠标左键点击表名称,即显示表的一切详细情况(表空间,表名称,索引,列,键,权限,触发器 ...)
Ⅷ sql server怎么查看表结构
SQL Server查询表结构语句
--1:获取当前数据库中的所有用户表 www.2cto.com
select Name from sysobjects where xtype='u' and status>=0
--2:获取某一个表的所有字段
select name from syscolumns where id=object_id('表名')
--3:查看与某一个表相关的视图、存储过程、函数
select a.* from sysobjects a, syscomments b where a.id = b.id and b.text like '%表名%'
--4:查看当前数据库中所有存储过程
select name as 存储过程名称 from sysobjects where xtype='P'
--5:查询用户创建的所有数据库
select * from master..sysdatabases D where sid not in(select sid from master..syslogins where name='sa')
或者
select dbid, name AS DB_NAME from master..sysdatabases where sid <> 0x01
--6:查询某一个表的字段和数据类型
select column_name,data_type from information_schema.columns
where table_name = '表名'
Ⅸ 怎样用 SQL 查看表结构
用管理员用户登陆数据库服务器,输入:dbschema -d 数据库名称 -t 表名 -ss
Ⅹ oracle怎么通过sql查看表的结构
分两种方法:
1、在命令窗口通过如下语句:
desc表名;