Mysql系列 - 第4天:DDL常见操作汇总

2023-11-10

这是Mysql系列第4篇。

环境:mysql5.7.25,cmd命令中进行演示。

DDL:Data Define Language数据定义语言,主要用来对数据库、表进行一些管理操作。

如:建库、删库、建表、修改表、删除表、对列的增删改等等。

文中涉及到的语法用[]包含的内容属于可选项,下面做详细说明。

库的管理

创建库

create database [if not exists] 库名;

删除库

drop databases [if exists] 库名;

建库通用的写法

drop database if exists 旧库名;
create database 新库名;

示例

mysql> show databases like 'javacode2018';
+-------------------------+
| Database (javacode2018) |
+-------------------------+
| javacode2018            |
+-------------------------+
1 row in set (0.00 sec)

mysql> drop database if exists javacode2018;
Query OK, 0 rows affected (0.00 sec)

mysql> show databases like 'javacode2018';
Empty set (0.00 sec)

mysql> create database javacode2018;
Query OK, 1 row affected (0.00 sec)

show databases like 'javacode2018';列出javacode2018库信息。

表管理

创建表

create table 表名(
    字段名1 类型[(宽度)] [约束条件] [comment '字段说明'],
    字段名2 类型[(宽度)] [约束条件] [comment '字段说明'],
    字段名3 类型[(宽度)] [约束条件] [comment '字段说明']
)[表的一些设置];

注意:

  1. 在同一张表中,字段名不能相同

  2. 宽度和约束条件为可选参数,字段名和类型是必须的

  3. 最后一个字段后不能加逗号

  4. 类型是用来限制 字段 必须以何种数据类型来存储记录

  5. 类型其实也是对字段的约束(约束字段下的记录必须为XX类型)

  6. 类型后写的 约束条件 是在类型之外的 额外添加的约束

约束说明

not null:标识该字段不能为空

mysql> create table test1(a int not null comment '字段a');
Query OK, 0 rows affected (0.01 sec)

mysql> insert into test1 values (null);
ERROR 1048 (23000): Column 'a' cannot be null
mysql> insert into test1 values (1);
Query OK, 1 row affected (0.00 sec)

mysql> select * from test1;
+---+
| a |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

default value:为该字段设置默认值,默认值为value

mysql> drop table IF EXISTS test2;
Query OK, 0 rows affected (0.01 sec)

mysql> create table test2(
    ->   a int not null comment '字段a',
    ->   b int not null default 0 comment '字段b'
    -> );
Query OK, 0 rows affected (0.02 sec)

mysql> insert into test2(a) values (1);
Query OK, 1 row affected (0.00 sec)

mysql> select *from test2;
+---+---+
| a | b |
+---+---+
| 1 | 0 |
+---+---+
1 row in set (0.00 sec)

上面插入时未设置b的值,自动取默认值0

primary key:标识该字段为该表的主键,可以唯一的标识记录,插入重复的会报错

两种写法,如下:

方式1:跟在列后,如下:

mysql> drop table IF EXISTS test3;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> create table test3(
    ->   a int not null comment '字段a' primary key
    -> );
Query OK, 0 rows affected (0.01 sec)

mysql> insert into test3 (a) values (1);
Query OK, 1 row affected (0.01 sec)

mysql> insert into test3 (a) values (1);
ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'

方式2:在所有列定义之后定义,如下:

mysql> drop table IF EXISTS test4;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> create table test4(
    ->   a int not null comment '字段a',
    ->   b int not null default 0 comment '字段b',
    ->   primary key(a)
    -> );
Query OK, 0 rows affected (0.02 sec)

mysql> insert into test4(a,b) values (1,1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into test4(a,b) values (1,2);
ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'

插入重复的值,会报违法主键约束

方式2支持多字段作为主键,多个之间用逗号隔开,语法:primary key(字段1,字段2,字段n),示例:

mysql> drop table IF EXISTS test7;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>
mysql> create table test7(
    ->    a int not null comment '字段a',
    ->    b int not null comment '字段b',
    ->   PRIMARY KEY (a,b)
    ->  );
Query OK, 0 rows affected (0.02 sec)

mysql>
mysql> insert into test7(a,b) VALUES (1,1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into test7(a,b) VALUES (1,1);
ERROR 1062 (23000): Duplicate entry '1-1' for key 'PRIMARY'

foreign key:为表中的字段设置外键

语法:foreign key(当前表的列名) references 引用的外键表(外键表中字段名称)

mysql> drop table IF EXISTS test6;
Query OK, 0 rows affected (0.01 sec)

mysql> drop table IF EXISTS test5;
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql> create table test5(
    ->   a int not null comment '字段a' primary key
    -> );
Query OK, 0 rows affected (0.02 sec)

mysql>
mysql> create table test6(
    ->   b int not null comment '字段b',
    ->   ts5_a int not null,
    ->   foreign key(ts5_a) references test5(a)
    -> );
Query OK, 0 rows affected (0.01 sec)

mysql> insert into test5 (a) values (1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into test6 (b,test6.ts5_a) values (1,1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into test6 (b,test6.ts5_a) values (2,2);
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`javacode2018`.`test6`, CONSTRAINT `test6_ibfk_1` FOREIGN KEY (`ts5_a`) REFERENCES `test5` (`a`))

说明:表示test6中ts5_a字段的值来源于表test5中的字段a。

注意几点:

  • 两张表中需要建立外键关系的字段类型需要一致

  • 要设置外键的字段不能为主键

  • 被引用的字段需要为主键

  • 被插入的值在外键表必须存在,如上面向test6中插入ts5_a为2的时候报错了,原因:2的值在test5表中不存在

unique key(uq):标识该字段的值是唯一的

支持一个到多个字段,插入重复的值会报违反唯一约束,会插入失败。

定义有2种方式。

方式1:跟在字段后,如下:

mysql> drop table IF EXISTS test8;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>
mysql> create table test8(
    ->    a int not null comment '字段a' unique key
    ->  );
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql> insert into test8(a) VALUES (1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into test8(a) VALUES (1);
ERROR 1062 (23000): Duplicate entry '1' for key 'a'

方式2:所有列定义之后定义,如下:

mysql> drop table IF EXISTS test9;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>
mysql> create table test9(
    ->    a int not null comment '字段a',
    ->   unique key(a)
    ->  );
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql> insert into test9(a) VALUES (1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into test9(a) VALUES (1);
ERROR 1062 (23000): Duplicate entry '1' for key 'a'

方式2支持多字段,多个之间用逗号隔开,语法:primary key(字段1,字段2,字段n),示例:

mysql> drop table IF EXISTS test10;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>
mysql> create table test10(
    ->   a int not null comment '字段a',
    ->   b int not null comment '字段b',
    ->   unique key(a,b)
    -> );
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql> insert into test10(a,b) VALUES (1,1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into test10(a,b) VALUES (1,1);
ERROR 1062 (23000): Duplicate entry '1-1' for key 'a'

auto_increment:标识该字段的值自动增长(整数类型,而且为主键)

mysql> drop table IF EXISTS test11;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>
mysql> create table test11(
    ->   a int not null AUTO_INCREMENT PRIMARY KEY comment '字段a',
    ->   b int not null comment '字段b'
    -> );
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql> insert into test11(b) VALUES (10);
Query OK, 1 row affected (0.00 sec)

mysql> insert into test11(b) VALUES (20);
Query OK, 1 row affected (0.00 sec)

mysql> select * from test11;
+---+----+
| a | b  |
+---+----+
| 1 | 10 |
| 2 | 20 |
+---+----+
2 rows in set (0.00 sec)

字段a为自动增长,默认值从1开始,每次+1

关于自动增长字段的初始值、步长可以在mysql中进行设置,比如设置初始值为1万,每次增长10

注意:

自增长列当前值存储在内存中,数据库每次重启之后,会查询当前表中自增列的最大值作为当前值,如果表数据被清空之后,数据库重启了,自增列的值将从初始值开始

我们来演示一下:

mysql> delete from test11;
Query OK, 2 rows affected (0.00 sec)

mysql> insert into test11(b) VALUES (10);
Query OK, 1 row affected (0.00 sec)

mysql> select * from test11;
+---+----+
| a | b  |
+---+----+
| 3 | 10 |
+---+----+
1 row in set (0.00 sec)

上面删除了test11数据,然后插入了一条,a的值为3,执行下面操作:

删除test11数据,重启mysql,插入数据,然后看a的值是不是被初始化了?如下:

mysql> delete from test11;
Query OK, 1 row affected (0.00 sec)

mysql> select * from test11;
Empty set (0.00 sec)

mysql> exit
Bye

C:\Windows\system32>net stop mysql
mysql 服务正在停止..
mysql 服务已成功停止。


C:\Windows\system32>net start mysql
mysql 服务正在启动 .
mysql 服务已经启动成功。


C:\Windows\system32>mysql -uroot -p
Enter password: *******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.25-log MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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 javacode2018;
Database changed
mysql> select * from test11;
Empty set (0.01 sec)

mysql> insert into test11 (b) value (100);
Query OK, 1 row affected (0.00 sec)

mysql> select * from test11;
+---+-----+
| a | b   |
+---+-----+
| 1 | 100 |
+---+-----+
1 row in set (0.00 sec)

删除表

drop table [if exists] 表名;

修改表名

alter table 表名 rename [to] 新表名;

表设置备注

alter table 表名 comment '备注信息';

复制表

只复制表结构
create table 表名 like 被复制的表名;

如:

mysql> create table test12 like test11;
Query OK, 0 rows affected (0.01 sec)

mysql> select * from test12;
Empty set (0.00 sec)

mysql> show create table test12;
+--------+-------+
| Table  | Create Table                                                                                                                                           
+--------+-------+
| test12 | CREATE TABLE `test12` (
  `a` int(11) NOT NULL AUTO_INCREMENT COMMENT '字段a',
  `b` int(11) NOT NULL COMMENT '字段b',
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8     |
+--------+-------+
1 row in set (0.00 sec)
复制表结构+数据
create table 表名 [as] select 字段,... from 被复制的表 [where 条件];

如:

mysql> create table test13 as select * from test11;
Query OK, 1 row affected (0.02 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> select * from test13;
+---+-----+
| a | b   |
+---+-----+
| 1 | 100 |
+---+-----+
1 row in set (0.00 sec)

表结构和数据都过来了。

表中列的管理

添加列

alter table 表名 add column 列名 类型 [列约束];

示例:

mysql> drop table IF EXISTS test14;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>
mysql> create table test14(
    ->   a int not null AUTO_INCREMENT PRIMARY KEY comment '字段a'
    -> );
Query OK, 0 rows affected (0.02 sec)

mysql> alter table test14 add column b int not null default 0 comment '字段b';
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> alter table test14 add column c int not null default 0 comment '字段c';
Query OK, 0 rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> insert into test14(b) values (10);
Query OK, 1 row affected (0.00 sec)

mysql> select * from test14;                                                 c
+---+----+---+
| a | b  | c |
+---+----+---+
| 1 | 10 | 0 |
+---+----+---+
1 row in set (0.00 sec)

修改列

alter table 表名 modify column 列名 新类型 [约束];
或者
alter table 表名 change column 列名 新列名 新类型 [约束];

2种方式区别:modify不能修改列名,change可以修改列名

我们看一下test14的表结构:

mysql> show create table test14;
+--------+--------+
| Table  | Create Table |
+--------+--------+
| test14 | CREATE TABLE `test14` (
  `a` int(11) NOT NULL AUTO_INCREMENT COMMENT '字段a',
  `b` int(11) NOT NULL DEFAULT '0' COMMENT '字段b',
  `c` int(11) NOT NULL DEFAULT '0' COMMENT '字段c',
  PRIMARY KEY (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8       |
+--------+--------+
1 row in set (0.00 sec)

我们将字段c名字及类型修改一下,如下:

mysql> alter table test14 change column c d varchar(10) not null default '' comment '字段d';
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> show create table test14;                                                          ;;
+--------+--------+
| Table  | Create Table |
+--------+--------+
| test14 | CREATE TABLE `test14` (
  `a` int(11) NOT NULL AUTO_INCREMENT COMMENT '字段a',
  `b` int(11) NOT NULL DEFAULT '0' COMMENT '字段b',
  `d` varchar(10) NOT NULL DEFAULT '' COMMENT '字段d',
  PRIMARY KEY (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8       |
+--------+--------+
1 row in set (0.00 sec)

删除列

alter table 表名 drop column 列名;

示例:

mysql> alter table test14 drop column d;
Query OK, 0 rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> show create table test14;
+--------+--------+
| Table  | Create Table |
+--------+--------+
| test14 | CREATE TABLE `test14` (
  `a` int(11) NOT NULL AUTO_INCREMENT COMMENT '字段a',
  `b` int(11) NOT NULL DEFAULT '0' COMMENT '字段b',
  PRIMARY KEY (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8     |
+--------+--------+
1 row in set (0.00 sec)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Mysql系列 - 第4天:DDL常见操作汇总 的相关文章

  • MySQL JDBC 连接上的故障转移?

    我正在尝试确定如何使用 MySQL JDBC 驱动程序实现高可用性解决方案 似乎有一个我可以设置的故障转移属性 但我想知道当使用 MySQL 和 JDBC 实现简单的故障转移机制时 人们倾向于使用什么 我们计划将 2 个前端 Tomcat
  • MySQL 布尔模式匹配对中间词不返回任何内容

    我在 MySQL 数据库中使用 Match Against 时遇到问题 希望有人能提供帮助 这是我的数据库中的数据示例 id name 1 really bitter chocolate 2 soft cheese 当我运行此查询时 SEL
  • 检查字段是否为空

    如果我想检查该字段是否有除 null 和空之外的其他字符 查询是否正确 select CASE WHEN description IS NULL THEN null WHEN description IS NOT NULL THEN not
  • 美国邮政编码的最佳列类型是什么?

    我想存储Zip Code 美国境内 MySQL 数据库中 Saving空间是一个优先考虑的因素 使用 VARCHAR 最大长度限制为 6 位或使用 INT 或使用 MEDIUM Int 是更好的选择 邮政编码不会用于任何计算 邮政编码将用于
  • 尝试通过 JDBC 将 UTF-8 插入 MySQL 时出现“错误的字符串值”?

    这就是我的连接设置方式 Connection conn DriverManager getConnection url dbName useUnicode true characterEncoding utf 8 userName pass
  • 返回表中不存在的记录

    如何获取表中没有记录的ID 例如 select id name mail from users where id in 2 3 4 5 6 该查询返回记录 2 3 4 的输出 但不返回记录 5 和 6 因为表中不存在记录 现在我想知道表中没
  • 在 PHP / MySQL 中处理未读帖子

    对于个人项目 我需要使用 PHP 和 MySQL 构建一个论坛 我不可能使用已经构建的论坛包 例如phpBB 我目前正在研究构建此类应用程序所需的逻辑 但这已经是漫长的一天了 我正在努力解决为用户处理未读帖子的概念 我的一个解决方案是有一个
  • 土耳其语字符显示不正确[重复]

    这个问题在这里已经有答案了 MySql 数据库使用 utf 8 编码 数据存储正确 我使用 set name utf8 查询来确保调用的数据是 utf 8 编码 只要标头字符集是 utf 8 数据库中的所有变量都可以正常工作 但静态html
  • 如何在 mySQL 中定义自定义 ORDER BY 顺序

    在 MySQL 中如何定义自定义排序顺序 为了尝试解释我想要的内容 请考虑这张表 ID Language Text 0 ENU a 0 JPN b 0 DAN c 1 ENU d 1 JPN e 1 DAN f 2 etc 在这里 我想返回
  • 如何在SQL中编写连接查询[关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 问题 给定 Employee 和 AnnualReviews 表 编写一个查询以返回所有从未接受过按 HireDate 排序的评论的员
  • 如何修复损坏的 xampp 'mysql.user' 表?

    我昨天使用 Xampp 创建了一些简单的基于 Web 的实用工具 今天我想继续研究它 但 xampp 控制面板给了我一些奇怪的错误 这是 MySQL 错误日志 2019 07 20 23 47 13 0 Note InnoDB Uses e
  • Laravel 5:如何检索并显示属于特定类别的所有帖子

    我有3张桌子 user id username subreddits id name created at posts id title link user id subreddit id 问题是 我手动获取 subreddit 类别的 i
  • 减少每日状态表以仅包含状态更改

    我有一个包含 10 万以上用户的大型每日状态表 5 7 亿行 目前它位于 MySQL 或 CSV 中 该表包含三列 user id status 和 date 理想情况下 我希望将表缩减为一个新表 其中包含每个状态期间的 user id s
  • MySql - 自动完成

    我正在创建一个 Ajax 自动完成应用程序 并且想知道是否有一个 SQL 查询可以用于此目的 例如 如果有人键入 p 我想检索所有以 p 开头的单词 如果他们添加 e 检索所有以 pe 开头的单词 并继续这样 有人提出了下面的查询 但我认为
  • 是否可以在MySQL UDF中的IF条件中声明游标

    我可以在 if 语句中声明游标吗 如果可能的话我怎样才能做到 因为我刚刚做了这样的光标 CREATE FUNCTION fn test ProductID BIGINT 20 RETURNS DECIMAL 10 2 BEGIN DECLA
  • 如何根据状态从父表和子表获取数据,其中外键每行具有不同的状态

    我有 2 个具有外键关系的表 情况是我有一个case and a case有很多revisions 和每个revision有自己的status 如果仅更改外键表状态的特定行 我想获取父表数据和子数据 Table Case id case n
  • #1214 - 使用的表类型不支持 FULLTEXT 索引

    我收到一条错误消息 指出该表类型不支持 FULLTEXT 索引 我怎样才能实现这个目标 这是我的桌子 CREATE TABLE gamemech chat id bigint 20 unsigned NOT NULL auto increm
  • 通过左连接实现精确分页

    我已经思考这个问题有一段时间了 我认为最好四处询问并听听其他人的想法 我正在构建一个在 Mysql 上存储位置的系统 每个位置都有一个类型 有些位置有多个地址 表格看起来像这样 location location id autoincrem
  • MAMP Python-MySQLdb 问题:调用 Python 文件后 libssl.1.0.0.dylib 的路径发生变化

    我正在尝试使用 python MySQLdb 访问 MAMP 服务器上的 MySQL 数据库 当我最初尝试使用 python sql 调用 Python 文件来访问 MAMP 上的数据库时 我得到了image not found关于错误li
  • mysql - 有什么方法可以帮助使用另一个索引进行全文搜索?

    假设我有一个 文章 表 其中包含以下列 article text fulltext indexed author id indexed 现在我想搜索特定作者撰写的文章中出现的术语 所以像这样 select from articles whe

随机推荐

  • VUE 之 项目常规配置详解

    Vue 项目的常规配置可以分为以下几个方面 路由配置 使用 Vue Router 进行路由配置 需要在 src router index js 文件中配置路由表和路由守卫 状态管理 使用 Vuex 进行状态管理 需要在 src store
  • C++多线程:thread_local

    概念 首先thread local是一个关键词 thread local是C 11新引入的一种存储期指定符 它会影响变量的存储周期 Storage duration 与它同是存储期指定符的还有以下几个 关键字 说明 备注 auto 自动存储
  • new详解

    new int和new int 内置类型 对于int内置类型 new仅仅只是分配内存 除非后面显示加 相当于调用它的构造函数 int p new int 10 10个未初始化的int int p2 new int 10 10个值初始化为0的
  • 异步调用的四种方法

    异步调用的四种方法 我们都知道普通方法运行是单线程的 如果中途有大型操作都会导致方法阻塞 表现在界面上就是 程序卡或者死掉 界面元素不动了 不响应了 C 异步调用是很好的解决方法 异步执行某个方法 程序立即开辟一个新线程去运行你的方法 主线
  • 【ES6】var、let、const三者的区别

    首先 一个常见的问题是 ECMAScript 和 JavaScript 到底是什么关系 ECMAScript是一个国际通过的标准化脚本语言 JavaScript由ECMAScript和DOM BOM三者组成 可以简单理解为 ECMAScri
  • Java反射机制及Method.invoke详解

    这篇文章主要介绍了Java反射机制及Method invoke详解 本文讲解了JAVA反射机制 得到某个对象的属性 得到某个类的静态属性 执行某对象的方法 执行某个类的静态方法等内容 需要的朋友可以参考下 JAVA反射机制 JAVA反射机制
  • hackthebox的网站使用教程

    Google浏览器下载 下载url https www google cn chrome hackthebox网站 网站url https www hackthebox com home 获取验证码注册教程 网站url https blog
  • 运用打分和Boost优化Elasticsearch搜索结果

    来自Optimizing Search Results in Elasticsearch with Scoring and Boosting 作者 Neil Alex 2015 03 18 虽然es提供了高效的打分函数 但是在电商环境下还是
  • python趣味编程-扫雷游戏

    在上一期我们用Python实现了一个弹跳球的游戏 这一期我们继续使用Python实现一个简单的弹跳球游戏 让我们开始今天的旅程吧 Python中的扫雷游戏GUI免费源代码 这 Python中的扫雷游戏GUI免费源代码 是一个以 python
  • UE4 List View 在蓝图中的使用

    在使用中遇到的问题 蓝图中调用userListEntry 接口的IsListItemSelected IsListItemExpanded GetOwningListView 函数 均会崩溃 一 创建用作item显示的 控件蓝图 命名为 l
  • redis-cli 利用管道批量导入MySQL数据到Redis

    前言 因为公司业务的需要 需要快速的将mysql的中的数据查询导入到redis中 程序遍历MySQL然后插入Redis 效率极低 利用redis cli命令行工具有一个批量插入模式 是专门为批量执行命令设计的 可以把Mysql查询的内容格式
  • JS操作字符串方法学习系列(1)-每天学习10个方法

    目录 字符串连接 Concatenation 字符串长度 Length 字符串查找 Search 字符串替换 Replace 字符串分割 Split 字符串大小写转换 Case Conversion 字符串切片 Slice 字符串删除空白
  • 校园二手市场交易平台(JAVA,SSM,BOOTSTRAP,JSP,AJAX,MYSQL)

    今天 我们发布一套 校园二手市场交易 系统使用技术包含JAVA SSM BOOTSTRAP JSP AJAX MYSQL 这套系统后台框架使用SSM 前台框架为BOOTSTRAP 数据库使用MySql 这套系统包含完整的源代码和数据库脚本
  • 如何通过使用 SQL Server 中的 Detach 和 Attach 函数将 SQL Server 数据库移到新位置(转载)

    载自http support microsoft com kb 224071 zh cn 如何通过使用 SQL Server 中的 Detach 和 Attach 函数将 SQL Server 数据库移到新位置 参考概要本文描述如何更改任何
  • Element的message消息提示每次只出现一个

    使用element的message消息提示框有时出现这种重复弹出情况 解决办法 if document getElementsByClassName el message length 0 也就是当前没有提示弹窗 that message
  • 汽车变排量空调压缩机的工作原理

    不同于定排量压缩机 fixed displacement compressor FDC 变排量压缩机 variable displacement compressor VDC 可自动改变其泵送能力以满足空调的需求 当车厢温度高时 它会提高其
  • 《Perl语言入门》读书笔记(四)子程序

    1 子程序 1 1 定义子程序 使用关键字sub开头 在写上子程序名 字母 数字和下划线组成 不能以数字开头 大括号框柱子程序主体 子程序可以定义在文件的任意位置 为了方便代码阅读 一般建议放在开头或结尾处 sub marine n 1 全
  • WebSocket的使用指南---前端

    1 WebSocket概述 WebSocket 是 HTML5 开始提供的一种浏览器与服务器间进行全双工通讯的网络技术 WebSocket 通信协议于2011年被IETF定为标准RFC 6455 WebSocketAPI 被 W3C 定为标
  • String

    String是一个对象 不是基本数据类型 String的特点 字符串对象一旦初始化 便不能被修改 改变的只是引用型变量的指向 例如 String str abc String str ert abc 依然存在 只是str的指向变了 Stri
  • Mysql系列 - 第4天:DDL常见操作汇总

    这是Mysql系列第4篇 环境 mysql5 7 25 cmd命令中进行演示 DDL Data Define Language数据定义语言 主要用来对数据库 表进行一些管理操作 如 建库 删库 建表 修改表 删除表 对列的增删改等等 文中涉