sql中在指定的某个数据库中添加表的语句是什么?
来源:百度知道 编辑:UC知道 时间:2024/06/16 18:41:11
use 数据库名
create table 表名
( 相关字段名 字段类型
)
建议去查询一下帮助,帮助里说的很详细,要试着学会使用sql server自带的帮助。
指定数据库 关键字 Use
如下列SQL:
USE [Test]
GOCREATE TABLE [dbo].[test](
[testId] [char](12) NOT NULL,
[TestName] [nvarchar](100) NULL)
GO说明,在Test数据库上创建test表
例如:
create table student --student 是表名
(
sno char(10) primary key,--学号字符型,主键
sname varhcar(12) not null,--姓名字符型,不能为空
)
具体看你要什么了
use 数据库名
create table 表名
(
name varchar not null
age int not null
...
)
go