今天用了一会儿sqlyog,感觉还是会让人懒惰,所以选择了ms-dos环境,感觉不错,原生态,敲着很爽;

| test01             |
| tree |
| world |
+--------------------+
18 rows in set (0.00 sec) mysql> create database if not exists myschool;
Query OK, 1 row affected (0.00 sec) mysql> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| bdqn |
| mybatis |
| myschool |
| myschool2 |
| mysql |
| news |
| performance_schema |
| sakila |
| school |
| smbms |
| smbmsdemo |
| ssh01 |
| t09 |
| t12 |
| test |
| test01 |
| tree |
| world |
+--------------------+
19 rows in set (0.00 sec) mysql> create table if not exists `subject`()
->
-> ;
ERROR 1046 (3D000): No database selected
mysql> create table if not exists `subject`(SubjectNo int(11),SubjectName vachar
(50),ClassHour int(4),GradeID int(4))comment='课程数据表';
ERROR 1046 (3D000): No database selected
mysql> use myschool;
Database changed
mysql> create table if not exists `subject`(SubjectNo int(11),SubjectName vachar
(50),ClassHour int(4),GradeID int(4))comment='课程数据表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'vacha
r(50),ClassHour int(4),GradeID int(4))comment='课程数据表'' at line 1
mysql> create table if not exists `subject`(SubjectNo int(11),SubjectName vachar
(50),ClassHour int(4),GradeID int(4))comment='课程数据表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'vacha
r(50),ClassHour int(4),GradeID int(4))comment='课程数据表'' at line 1
mysql> create table if not exists `subject`(SubjectNo int(11),SubjectName varcha
r(50),ClassHour int(4),GradeID int(4))comment='课程数据表';
Query OK, 0 rows affected (2.20 sec) mysql> select * from subject
-> ;
Empty set (0.00 sec) mysql> select * from `subject`;
Empty set (0.00 sec) mysql> insert into `subject` values('','高等数学-1','','');
Query OK, 1 row affected (0.14 sec) mysql> insert into `subject` values('','高等数学-2','','');
Query OK, 1 row affected (0.13 sec) mysql> insert into `subject` values('','高等数学-3','','');
Query OK, 1 row affected (0.13 sec) mysql> insert into `subject` values('','高等数学-4','','');
Query OK, 1 row affected (0.14 sec) mysql> insert into `subject` values('','C语言-1','','');
Query OK, 1 row affected (0.14 sec) mysql> insert into `subject` values('','C语言-2','','');
Query OK, 1 row affected (0.13 sec) mysql> select * from `subject`;
+-----------+-------------+-----------+---------+
| SubjectNo | SubjectName | ClassHour | GradeID |
+-----------+-------------+-----------+---------+
| 1 | 高等数学-1 | 120 | 1 |
| 2 | 高等数学-2 | 110 | 2 |
| 3 | 高等数学-3 | 100 | 3 |
| 4 | 高等数学-4 | 130 | 4 |
| 5 | C语言-1 | 120 | 1 |
| 6 | C语言-2 | 110 | 2 |
+-----------+-------------+-----------+---------+
6 rows in set (0.00 sec) mysql> create table if not exists grade;
ERROR 1113 (42000): A table must have at least 1 column
mysql> create table if not exists grade(GradeID int(11) primary key,GradeName va
rchar(50))comment='年级表';
Query OK, 0 rows affected (2.22 sec) mysql> insert into grade values('','大一');
Query OK, 1 row affected (0.11 sec) mysql> insert into grade values('','大二');
Query OK, 1 row affected (0.13 sec) mysql> insert into grade values('','大三');
Query OK, 1 row affected (0.13 sec) mysql> insert into grade values('','大四');
ERROR 1062 (23000): Duplicate entry '' for key 'PRIMARY'
mysql> insert into grade values('','大四');
Query OK, 1 row affected (0.13 sec) mysql> select * from grade;
+---------+-----------+
| GradeID | GradeName |
+---------+-----------+
| 1 | 大一 |
| 2 | 大二 |
| 3 | 大三 |
| 4 | 大四 |
+---------+-----------+
4 rows in set (0.00 sec) mysql> create table if not exists student(StudentNo int(4) not null comment '学
号'),,,Loginarchar(20) default null,StudentName varchar(20) default null comment
'学ent '学生姓名',,,,,
'> ;
'> ;
'> kdjsf;a
'> ;
'> Bye C:\Users\Administrator>mysql -uroot -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.54-log MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use myschool;
Database changed
mysql> create table if not exists student(StudentNo int(4) not null comment '学
号',LoginPwd varchar(20) default null,StudentName varchar(20) default null comme
nt '学生姓名',Sex tinyint(1) default null comment '性别,取值0或1',GradeId int(1
1) default null comment '年级编号',Phone varchar(50) not null comment '联系电话
,允许为空,即可选输入',Address varchar(255) not null comment '地址,允许为空,
即可选输入',BornDate datetime default null comment '出生时间',Email varchar(50)
not null comment '邮箱账号,允许为空,即可选输入',IdentityCard varchar(18) defau
lt null comment '身份证号')comment='学生类';
Query OK, 0 rows affected (0.53 sec) mysql> select * from student;
Empty set (0.02 sec) mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| bdqn |
| mybatis |
| myschool |
| myschool2 |
| mysql |
| news |
| performance_schema |
| sakila |
| school |
| smbms |
| smbmsdemo |
| ssh01 |
| t09 |
| t12 |
| test |
| test01 |
| tree |
| world |
+--------------------+
19 rows in set (0.00 sec) mysql> use myschool;
Database changed
mysql> select * from student;
Empty set (0.00 sec) mysql> show tables;
+--------------------+
| Tables_in_myschool |
+--------------------+
| grade |
| student |
| subject |
+--------------------+
3 rows in set (0.00 sec) mysql> select * from subject;
+-----------+-------------+-----------+---------+
| SubjectNo | SubjectName | ClassHour | GradeID |
+-----------+-------------+-----------+---------+
| 1 | 高等数学-1 | 120 | 1 |
| 2 | 高等数学-2 | 110 | 2 |
| 3 | 高等数学-3 | 100 | 3 |
| 4 | 高等数学-4 | 130 | 4 |
| 5 | C语言-1 | 120 | 1 |
| 6 | C语言-2 | 110 | 2 |
+-----------+-------------+-----------+---------+
6 rows in set (0.00 sec) mysql> use myschool;
Database changed
mysql> show tables;
+--------------------+
| Tables_in_myschool |
+--------------------+
| grade |
| student |
| subject |
+--------------------+
3 rows in set (0.00 sec) mysql> drop subject if exists;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'subje
ct if exists' at line 1
mysql> drop table subject if exists;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'if ex
ists' at line 1
mysql> drop `subject` if exists;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '`subj
ect` if exists' at line 1
mysql> drop table if exists subject;
Query OK, 0 rows affected (0.47 sec) mysql> show tables;
+--------------------+
| Tables_in_myschool |
+--------------------+
| grade |
| student |
+--------------------+
2 rows in set (0.00 sec) mysql> create table if not exists subject(SubjectNo in(11) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'in(11
) not null comment '课程编号',SubjectName varchar(50) default null comm' at line
1
mysql> create table if not exists subject(SubjectNo in(11) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号')engi
ne=MyISAM,comment='课程名称表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'in(11
) not null comment '课程编号',SubjectName varchar(50) default null comm' at line
1
mysql> create table if not exists subject(SubjectNo in(11) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号')engi
ne=MyISAM comment='课程名称表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'in(11
) not null comment '课程编号',SubjectName varchar(50) default null comm' at line
1
mysql> create table if not exists subject(SubjectNo in(11) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号')engi
ne=MyISAM comment='课程名称表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'in(11
) not null comment '课程编号',SubjectName varchar(50) default null comm' at line
1
mysql> create table if not exists subject(SubjectNo in(0t1) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号')engi
ne=MyISAM comment='课程名称表';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'in(0t
1) not null comment '课程编号',SubjectName varchar(50) default null com' at line
1
mysql> create table if not exists subject(SubjectNo in(11) not null comment '课
程编号',SubjectName varchar(50) default null comment '课程名称',ClassHour int(4)
default null comment '学时',GradeID int(4) default null comment '年级编号')engi
ne=MyISAM,comment='课程名称表'; ;

mysql练习代码

当然ms-dos的缺点也很多:

1 不好编辑,特别是错了的时候,会乱

2 写完保存代码很困难

3 每次语句写完都要打分号

mysql20170407代码实现的更多相关文章

  1. 日期格式代码出现两次的错误 ORA-01810

    错误的原因是使用了两次MM . 一.Oracle中使用to_date()时格式化日期需要注意格式码 如:select to_date('2005-01-01 11:11:21','yyyy-MM-dd ...

  2. 可爱的豆子——使用Beans思想让Python代码更易维护

    title: 可爱的豆子--使用Beans思想让Python代码更易维护 toc: false comments: true date: 2016-06-19 21:43:33 tags: [Pyth ...

  3. iOS代码规范(OC和Swift)

    下面说下iOS的代码规范问题,如果大家觉得还不错,可以直接用到项目中,有不同意见 可以在下面讨论下. 相信很多人工作中最烦的就是代码不规范,命名不规范,曾经见过一个VC里有3个按钮被命名为button ...

  4. Jquery的点击事件,三句代码完成全选事件

    先来看一下Js和Jquery的点击事件 举两个简单的例子 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN&q ...

  5. redux-amrc:用更少的代码发起异步 action

    很多人说 Redux 代码多,开发效率低.其实 Redux 是可以灵活使用以及拓展的,经过充分定制的 Redux 其实写不了几行代码.今天先介绍一个很好用的 Redux 拓展-- redux-amrc ...

  6. 编写高质量代码:改善Java程序的151个建议(第5章:数组和集合___建议75~78)

    建议75:集合中的元素必须做到compareTo和equals同步 实现了Comparable接口的元素就可以排序,compareTo方法是Comparable接口要求必须实现的,它与equals方法 ...

  7. 使用 .NET WinForm 开发所见即所得的 IDE 开发环境,实现不写代码直接生成应用程序

    直接切入正题,这是我09年到11年左右业余时间编写的项目,最初的想法很简单,做一个能拖拖拽拽就直接生成应用程序的工具,不用写代码,把能想到的业务操作全部封装起来,通过配置的方式把这些业务操作组织起来运 ...

  8. jsp前端实现分页代码

    前端需要订一page类包装,其参数为 private Integer pageSize=10; //每页记录条数=10 private Integer totalCount; //总记录条数 priv ...

  9. 【开源】简单4步搞定QQ登录,无需什么代码功底【无语言界限】

    说17号发超简单的教程就17号,qq核审通过后就封装了这个,现在放出来~~ 这个是我封装的一个开源项目:https://github.com/dunitian/LoTQQLogin ————————— ...

随机推荐

  1. intellij idea console 乱码

    修改文件 位置:{用户目录}\{iedea对应版本}\{idea or idea64}.vmoptions 比如我要修改我的配置文件 C:\Users\kkblf\.IntelliJIdea2017. ...

  2. HDU_1242_Rescue

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1242 大意:迷宫搜索,'#'代表墙,'.'代表路,'x'代表守卫,每移动1格用1秒,杀死守卫用1秒,ang ...

  3. 外观模式(Facade)-子系统的协作与整合-接口模式

    对子系统进行整合,对外提供更强大或更便捷的接口. 在一个模块和几个子系统进行通信时考虑. 什么是外观模式? 外观模式(Facade),为子系统中的一组接口提供一个一致的界面,定义一个高层接口,这个接口 ...

  4. tee命令用法

    用途说明 在执行Linux命令时,我们可以把输出重定向到文件中,比如 ls >a.txt,这时我们就不能看到输出了,如果我们既想把输出保存到文件中,又想在屏幕上看到输出内容,就可以使用tee命令 ...

  5. 禁止foreach循环使用remove/add----快速失败

    阿里巴巴开发手册中有一条: 7[强制]不要在 foreach 循环里进行元素的 remove / add 操作. remove 元素请使用 Iterator 方式,如果并发操作,需要对 Iterato ...

  6. ThinkPHP---ue编辑器

    [一]简介 (1)介绍 一款百度开发的JS插件 ue编辑器,全称Ueditor(翻译为你的编辑器),百度开发的在线编辑器,是一款在线编辑器软件,在线编辑器又称为“富文本编辑器”. 国外也有一款类似的编 ...

  7. 调用微信扫一扫功能,踩坑'invalid signature'

    在vue项目中,调用微信扫一扫功能,在安卓系统下完全正常,ios系统下却报错'invalid signature'的错误,这可能令许多小伙伴困惑,经过查询大量博客相关资料,才找到了解决的方法. 原因: ...

  8. Linux常用命令——帮助命令

    1.帮助命令:man man 命令 获取指定命令的帮助 [dmtsai@study ~]$ man date DATE (1) User Commands DATE(1) #注意这个(1),代表的是m ...

  9. Python基础之字符的编码

    参考原文 Python廖雪峰 为什么要进行编码? 计算机只能处理二进制数字(0100111),要处理文本,就必须先把文本转为数字才能处理,这个过程就叫编码. 字符的编码 ASCII编码 由于计算机是美 ...

  10. MySQL数据库grant授权命令

    MySQL数据库grant授权命令 制作人:全心全意 grant授权命令的使用 grant授权命令使用语法: grant 权限 on 数据库对象 to 用户 grant 权限 on 数据库对象 to ...