Linux学习笔记CentOS 6.5(十一)---数据库练习步骤

1.正确打开数据库,打开连接工具(此步骤出现问题可参考我之前的文章)奋斗

2.然后新建一个数据库(我这里建的是testjdbc)

3.点击新建好的数据库,点击新建查询

4.将下列中的语句,复制到空白面板中:

CREATE TABLE emp

(empno smallint(4) not null primary key,

 ename varchar(10),

 job varchar(9),

 mgr smallint(4),

 hiredate date,

 sal float(7, 2),

 comm float(7, 2),

 deptno tinyint(2)

) engine=innodb charset=utf8;



INSERT INTO emp VALUES (7369, '员工SMITH',  'CLERK',     7902, '1980-12-17',  800, NULL, 20);

INSERT INTO emp VALUES (7499, '员工ALLEN',  'SALESMAN',  7698, '1981-02-20', 1600,  300, 30);

INSERT INTO emp VALUES (7521, '员工WARD',   'SALESMAN',  7698, '1981-02-22', 1250,  500, 30);

INSERT INTO emp VALUES (7566, '员工JONES',  'MANAGER',   7839, '1981-04-02',  2975, NULL, 20);

INSERT INTO emp VALUES (7654, '员工MARTIN', 'SALESMAN',  7698, '1981-09-28', 1250, 1400, 30);

INSERT INTO emp VALUES (7698, '员工BLAKE',  'MANAGER',   7839, '1981-05-01',  2850, NULL, 30);

INSERT INTO emp VALUES (7782, '员工CLARK',  'MANAGER',   7839, '1981-06-09',  2450, NULL, 10);

INSERT INTO emp VALUES (7788, '员工SCOTT',  'ANALYST',   7566, '1982-10-09', 3000, NULL, 20);

INSERT INTO emp VALUES (7839, '员工KING',   'PRESIDENT', NULL, '1981-11-17', 5000, NULL, 10);

INSERT INTO emp VALUES (7844, '员工TURNER', 'SALESMAN',  7698, '1981-09-08',  1500,    0, 30);

INSERT INTO emp VALUES (7876, '员工ADAMS',  'CLERK',     7788, '1983-01-12', 1100, NULL, 20);

INSERT INTO emp VALUES (7900, '员工JAMES',  'CLERK',     7698, '1981-12-03',   950, NULL, 30);

INSERT INTO emp VALUES (7902, '员工FORD',   'ANALYST',   7566, '1981-12-03',  3000, NULL, 20);

INSERT INTO emp VALUES (7934, '员工MILLER', 'CLERK',     7782, '1982-01-23', 1300, NULL, 10);



create table dept

(deptno tinyint(2) primary key,

 dname varchar(14),

 loc varchar(13)

) engine=innodb charset=utf8;
INSERT INTO dept VALUES (10, '部门ACCOUNTING', 'NEW YORK');

INSERT INTO dept VALUES (20, '部门RESEARCH',   'DALLAS');

INSERT INTO dept VALUES (30, '部门SALES',      'CHICAGO');

INSERT INTO dept VALUES (40, '部门OPERATIONS', 'BOSTON ');

5.然后全部选中,点击运行:

6.接着刷新数据库,刷新表,就会看到刚才新建好的两个表:

    

7.那么现在就可以根据自己掌握程度进行练习了,这里我先做一个简单示范:

*运行的时候,选中该语句即可*运行结果如下所示:

8.是不是很简单啊!小伙伴们一起练习起来吧大笑

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值