找到 4219 篇文章 关于 MySQLi
68 次查看
让我们首先创建一个表 - mysql> create table DemoTable( Value int, Value2 varchar(100) ); Query OK, 0 rows affected (0.84 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable values(10, '999.999.999.999'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values(20, '888.888.888.888'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(30, '999.999.999.999'); Query OK, 1 row affected (0.09 sec)使用 select 语句显示表中的所有记录 - mysql> select *from DemoTable;这将产生以下输出 -+-------+-----------------+ | Value | Value2 ... 阅读更多
311 次查看
是的,我们可以这样做。让我们首先创建一个表 - mysql> create table DemoTable( Id int ); Query OK, 0 rows affected (1.02 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable values(201); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable values(202); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values(290); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(301); Query OK, 1 row affected (0.13 sec)使用 select 语句显示表中的所有记录 - mysql> select *from DemoTable;这将产生以下输出 -+------+ ... 阅读更多
2K+ 次查看
@@identity 返回当前会话中 auto_increment 列中最后插入的值。让我们首先创建一个表 - mysql> create table DemoTable( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserName varchar(100) ); Query OK, 0 rows affected (0.67 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable(UserName) values('David'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(UserName) values('Mike'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(UserName) values('Carol'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(UserName) values('Robert'); Query OK, 1 row affected (0.24 sec) ... 阅读更多
152 次查看
让我们首先创建一个表 - mysql> create table DemoTable( ProductName varchar(100), ProductPrice int ); Query OK, 0 rows affected (0.68 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable values('Product-1', 56); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Product-2', 78); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable values('Product-1', 88); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Product-2', 86); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('Product-1', 45); Query OK, 1 row affected (0.18 sec) mysql> insert into ... 阅读更多
398 次查看
如果您要扩展 MySQL 中 varchar 字段的大小,则它不会影响其内部的数据。让我们首先创建一个表 - mysql> create table DemoTable( Name varchar(8) ); Query OK, 0 rows affected (1.11 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('Robert'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('Mike'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Sam'); Query OK, 1 row affected (0.13 sec)显示来自... 阅读更多
70 次查看
让我们首先创建一个表 - mysql> create table DemoTable( FirstName varchar(100) ); Query OK, 0 rows affected (0.97 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable values('Chris'); Query OK, 1 row affected (0.31 sec) mysql> insert into DemoTable values('Adam'); Query OK, 1 row affected (0.35 sec) mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values('Sam'); Query OK, 1 row affected (0.37 sec) mysql> insert into DemoTable values('Mike'); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable values('David'); Query OK, 1 row affected (0.27 ... 阅读更多
117 次查看
为此,您可以使用 PREPARE 语句。让我们首先创建一个表 - mysql> create table DemoTable( FirstName varchar(100), CountryName varchar(100) ); Query OK, 0 rows affected (0.53 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable values('Adam', 'US'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('Chris', 'AUS'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('Robert', 'UK'); Query OK, 1 row affected (0.32 sec)显示表中的所有记录,使用 select 语句 - mysql> select *from DemoTable;这将产生以下输出 -+-----------+-------------+ | FirstName | ... 阅读更多
97 次查看
为此,请使用 GROUP BY HAVING 子句。让我们首先创建一个表 - mysql> create table DemoTable( Name varchar(100), Age int ); Query OK, 0 rows affected (1.50 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable values('Chris', 23); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values('David', 21); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Chris', 23); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('Chris', 21); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable values('Mike', 25); Query OK, ... 阅读更多
109 次查看
为此,您需要使用 IN(),然后使用 FIELD() 方法。让我们首先创建一个表 - mysql> create table DemoTable( StudentId varchar(10), StudentName varchar(20) ) ; Query OK, 0 rows affected (4.11 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable values('10001', 'Adam'); Query OK, 1 row affected (0.52 sec) mysql> insert into DemoTable values('1010', 'Chris'); Query OK, 1 row affected (0.72 sec) mysql> insert into DemoTable values('1020', 'Bob'); Query OK, 1 row affected (0.34 sec) mysql> insert into DemoTable values('1030', 'Carol'); Query OK, 1 row affected (0.47 sec) mysql> insert into ... 阅读更多
2K+ 次查看
对于精确字符串,您需要使用通配符“%”与 LIKE 运算符一起使用 - select *from yourTableName where binary yourColumnName LIKE '%yourStringValue%';让我们首先创建一个表 - mysql> create table DemoTable( Name varchar(20) ); Query OK, 0 rows affected (1.93 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable values('Chris'); Query OK, 1 row affected (1.11 sec) mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.38 sec) mysql> insert into DemoTable values('Adam'); Query OK, 1 row affected (1.19 sec) mysql> insert into DemoTable values('JOHN'); Query OK, 1 row affected (0.60 sec) mysql> insert into DemoTable ... 阅读更多