hive里创建表test,表里添加两个字段id和name,以下哪个HQL是正确的( )
A: create test(id int, name string);
B: create test(int id, string name);
C: create table test(int id, string name);
D: create table test(id int, name string)
A: create test(id int, name string);
B: create test(int id, string name);
C: create table test(int id, string name);
D: create table test(id int, name string)
举一反三
- hive创建表并指定列分隔符的正确的HQL是( )。 A: create table dbtest(id int, name string) row format delimited terminate by ','; B: create table dbtest(int id, string name) row format delimited by ','; C: create table dbtest(id int, name string) row format delimited fields terminated by ','; D: create table dbtest(int id, string name) row format delimited columns fields terminated by ',';
- 为表TEST中ID列添加主键约束的语法是() A: ALTER TABLE TEST CHANGE( ID INT PRIMARY KEY) B: ALTER TABLE TEST ADD( ID INT PRIMARY KEY) C: ALTER TABLE TEST MODIFY( ID INT PRIMARY KEY) D: ALTER TABLE TEST ADD CONSTRAINT PK PRIMARY KEY (ID)
- 下来定义表的约束语法,错误的是() A: create table t1(id number primary key,name varchar2(10)) B: create table t1(id number constraint p_k primary key(id),name varchar2(10)) C: create table t1(id number constraint p_k primary key,name varchar2(10)) D: create table t1(id number,name varchar2(10),primary key(id))
- 创建表book(id,name,price),其中id为主键。create table book(id varchar __________ not null,.....);横线里进行填空。
- 表的创建命令:create table test( id int auto_increment primary key, name varchar(10) not null, password varchar(32) not null);如果在表中插入一条记录,语法正确的是: A: insert into test value(0,'张三',md5('123456')); B: insert into test values(0,张三,md5(123456)); C: insert into test value('张三',md5('123456')); D: insert into test values('张三',md5('123456'));