今天用了一会儿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. LeetCode第63题--不同路径

    一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” ).机器人每次只能向下或者向右移动一步.机器人试图达到网格的右下角(在下图中标记为“Finish”).现在考虑网格中 ...

  2. C# 绘图三种方式

    如果你想在窗体上进行绘画.通常会使用以下方法. 方法1,利用控件或窗体的paint事件中的painEventArgs private void form1_Paint(object sender, P ...

  3. sql IIF函数的应用

    工作中由于用各种框架,业务也不是很复杂,一直没怎么写过复杂的sql,今天写了一个 数据如下 代码如下 Sub 班级分数等级分析(shname) Dim Con As Object, rs As Obj ...

  4. <MySQL>入门四 事务控制语言 TCL

    -- TCL /* Transcation Control Language 事务控制语言 事务:一个或一组sql语句组成一个执行单元,这个执行单元要么全部执行,要么全部不执行 案例:转账 name ...

  5. mysql (5.7版本)---的配置

    1.去到官方网站下载 https://dev.mysql.com/downloads/installer/ 或者直接下载  -->  https://dev.mysql.com/get/Down ...

  6. 使用vuex实现父组件调用子组件方法

    曲线救国. 核心原理就是父子共用一个vuex对象,且看代码: 父组件parent.vue <template> <div class="wrap"> < ...

  7. python3爬虫-通过requests获取安居客房屋信息

    import requests from fake_useragent import UserAgent from lxml import etree from http import cookiej ...

  8. 基于 Ubuntu 搭建 FTP 文件服务

    搭建 FTP 文件服务 安装并启动 FTP 服务 任务时间:5min ~ 10min 安装 VSFTPD 使用 apt-get 安装 vsftpd: sudo apt-get install vsft ...

  9. PAT 1085 PAT单位排行

    每次 PAT 考试结束后,考试中心都会发布一个考生单位排行榜.本题就请你实现这个功能. 输入格式: 输入第一行给出一个正整数 N(≤10^5),即考生人数.随后 N 行,每行按下列格式给出一个考生的信 ...

  10. 负载均衡之Ocelot

    Ocelot 负载均衡:   背景知识,ocelot是基于 webapi 的网关框架,要使用ocelot来做路由转发和负载均衡,需要创建一个webapi,然后以这个webapi来做gateway.   ...