找到 4219 篇文章 适用于 MySQLi
906 次浏览
存储过程中的 @ 符号可用于用户定义的会话变量。让我们首先创建一个表 -mysql> create table DemoTable ( StudentName varchar(50) ); Query OK, 0 rows affected (1.30 sec)使用 insert 命令在表中插入一些记录 -mysql> insert into DemoTable values('John Smith'); Query OK, 1 row affected (1.00 sec) mysql> insert into DemoTable values('John Doe'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('Chris Brown'); Query OK, 1 row affected (0.53 sec)使用 select 语句显示表中的所有记录 -mysql> select *from DemoTable;这将产生以下输出 ... 阅读更多
107 次浏览
让我们首先创建一个表 -mysql> create table DemoTable ( FirstName varchar(100), LastName varchar(100) ); Query OK, 0 rows affected (0.83 sec)使用 insert 命令在表中插入一些记录 -mysql> insert into DemoTable values('Adam', 'Smith'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('John', 'Doe'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('John', 'Smith'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('Chris', 'Brown'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values('Robert', 'Brown'); Query OK, 1 row affected (0.10 sec) mysql> insert ... 阅读更多
105 次浏览
为此,您可以使用 MySQL 中空值的属性 IS NULL。让我们首先创建一个表 -mysql> create table DemoTable ( Name varchar(100) ); Query OK, 0 rows affected (0.53 sec)使用 insert 命令在表中插入一些记录 -mysql> insert into DemoTable values('Robert'); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable values(null); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('David'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values(null); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('Robert'); Query OK, 1 ... 阅读更多
123 次浏览
让我们首先创建一个表 -mysql> create table DemoTable ( Id int, ColorName varchar(100) ); Query OK, 0 rows affected (0.56 sec)使用 insert 命令在表中插入一些记录 -mysql> insert into DemoTable values(100, 'Red'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(101, 'Green'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values(101, 'Blue'); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable values(102, 'Yellow'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values(100, 'Purple'); Query OK, 1 row affected (0.12 sec) mysql> insert ... 阅读更多
78 次浏览
让我们首先创建一个表。这里,我们有 VARCHAR 类型的值 -mysql> create table DemoTable ( Value varchar(100) ); Query OK, 0 rows affected (1.80 sec)使用 insert 命令在表中插入一些记录 -mysql> insert into DemoTable values('100'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values('1244'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('15789'); Query OK, 1 row affected (0.18 sec)使用 select 语句显示表中的所有记录 -mysql> select *from DemoTable;这将产生以下输出 -+-------+ | Value | +-------+ | 100 | ... 阅读更多
873 次浏览
让我们首先创建一个表 -mysql> create table DemoTable ( Price int, Quantity int ); Query OK, 0 rows affected (0.71 sec)使用 insert 命令在表中插入一些记录 -mysql> insert into DemoTable values(45, 3); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(90, 2); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values(440, 1); Query OK, 1 row affected (0.09 sec)使用 select 语句显示表中的所有记录 -mysql> select *from DemoTable;这将产生以下输出 -+-------+----------+ | Price | Quantity | +-------+----------+ | ... 阅读更多
143 次浏览
让我们首先创建一个表 -mysql> create table DemoTable1 ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(100) ); Query OK, 0 rows affected (0.59 sec)使用 insert 命令在表中插入一些记录 -mysql> insert into DemoTable1(Name) values('Chris'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1(Name) values('Robert'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable1(Name) values('Mike'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1(Name) values('Sam'); Query OK, 1 row affected (0.07 sec)使用 select 语句显示表中的所有记录 -mysql> select *from DemoTable1;这将产生 ... 阅读更多
485 次浏览
让我们首先创建一个表 -mysql> create table DemoTable ( AdmissionDate date ); Query OK, 0 rows affected (0.87 sec)使用 insert 命令在表中插入一些记录 -mysql> insert into DemoTable values('2019-08-24'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('2019-08-25'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('2019-08-20'); Query OK, 1 row affected (0.24 sec)使用 select 语句显示表中的所有记录 -mysql> select *from DemoTable;这将产生以下输出 -+---------------+ | AdmissionDate | +---------------+ | 2019-08-24 | | 2019-08-25 | ... 阅读更多
31 次浏览
以下是语法 -select *from yourTableName order by yourColumnName*1, yourColumnName;让我们首先创建一个表 -mysql> create table DemoTable ( Value varchar(100) ); Query OK, 0 rows affected (0.62 sec)使用 insert 命令在表中插入一些记录 -mysql> insert into DemoTable values('90'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values('86'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values('45'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('85'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values('085'); Query OK, 1 row affected (0.14 sec) ... 阅读更多
322 次浏览
以下是语法 -select if(yourColumnName, 1, -1) from yourTableName;让我们首先创建一个表 -mysql> create table DemoTable ( isMarried boolean ); Query OK, 0 rows affected (0.60 sec)使用 insert 命令在表中插入一些记录 -mysql> insert into DemoTable values(true); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values(false); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(false); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(true); Query OK, 1 row affected (0.36 sec)使用 select 语句显示表中的所有记录 -mysql> select *from DemoTable;这将 ... 阅读更多