找到 4219 篇文章 关于 MySQLi
156 次查看
对于索引,您可以使用 KEY()。让我们首先创建一个 - mysql> create table DemoTable1437 -> ( -> StudentId int, -> StudentName varchar(20), -> StudentMarks int, -> StudentAge int -> , -> KEY(StudentId, StudentMarks, StudentAge) -> ); Query OK, 0 rows affected (0.97 sec) 以下是检查描述的查询 - mysql> desc DemoTable1437; 这将产生以下输出 - +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | StudentId | int(11) | YES | MUL ... 阅读更多
221 次查看
让我们首先创建一个 - mysql> create table DemoTable1436 -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(20) -> ); Query OK, 0 rows affected (1.06 sec) 使用 insert 插入一些记录 - mysql> insert into DemoTable1436(Name) values('Chris'); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable1436(Name) values('David'); Query OK, 1 row affected (0.40 sec) mysql> insert into DemoTable1436(Name) values('Bob'); Query OK, 1 row affected (0.35 sec) mysql> insert into DemoTable1436(Name) values('David'); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable1436(Name) values('David'); Query OK, 1 row affected ... 阅读更多
987 次查看
让我们首先看看语法,我们在其中从存储过程调用多个过程 - DELIMITER // CREATE PROCEDURE yourProcedureName() BEGIN CALL yourStoredProcedureName1(); CALL yourStoredProcedureName2(); . . N END // DELIMITER // 让我们实现上述语法来调用多个存储过程。以下是创建第一个存储过程的查询 - mysql> DELIMITER // mysql> CREATE PROCEDURE hello_message() -> BEGIN -> SELECT 'HELLO WORLD !!'; -> END -> // Query OK, 0 rows affected (0.19 sec) 创建第二个存储过程的查询如下 - mysql> CREATE PROCEDURE hi_message() -> ... 阅读更多
74 次查看
要显示像“01 August 2019”这样的日期,请使用 ORDER BY STR_TO_DATE()。让我们首先创建一个 - mysql> create table DemoTable1435 -> ( -> DueDate varchar(60) -> ); Query OK, 0 rows affected (1.08 sec) 使用 insert 插入一些记录 - mysql> insert into DemoTable1435 values('01 August 2019'); Query OK, 1 row affected (0.34 sec) mysql> insert into DemoTable1435 values('01 Feb 2018'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1435 values('31 Jan 2017'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable1435 values('01 March 2019'); Query OK, 1 row affected (0.11 sec) 显示 ... 阅读更多
829 次查看
对于减去日期,请使用 MySQL DATE_SUB()。让我们首先创建一个 - mysql> create table DemoTable1434 -> ( -> ArrivalDatetime datetime -> ); Query OK, 0 rows affected (3.14 sec) 使用 insert 插入一些记录 - mysql> insert into DemoTable1434 values('2019-09-30 21:10:00'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable1434 values('2018-09-30 22:20:40'); Query OK, 1 row affected (0.33 sec) mysql> insert into DemoTable1434 values('2017-09-30 23:10:00'); Query OK, 1 row affected (0.19 sec) 使用 select 显示表中的所有记录 - mysql> select * from DemoTable1434; 这将产生以下输出 - +---------------------+ | ArrivalDatetime ... 阅读更多
226 次查看
为此,请在 MySQL 中使用 CONCAT_WS()。让我们首先创建一个 - mysql> create table DemoTable1433 -> ( -> ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> ClientFirstName varchar(20), -> ClientLastName varchar(20) -> ); Query OK, 0 rows affected (0.58 sec) 使用 insert 插入一些记录 - mysql> insert into DemoTable1433(ClientFirstName, ClientLastName) values('David', 'Miller'); Query OK, 1 row affected (0.14 sec) 使用 select 显示表中的所有记录 - mysql> select * from DemoTable1433; 这将产生以下输出 - +----------+-----------------+----------------+ | ClientId | ClientFirstName | ClientLastName | +----------+-----------------+----------------+ | 1 | David | Miller | ... 阅读更多
102 次查看
让我们首先创建一个 - mysql> create table DemoTable1431 -> ( -> EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> EmployeeName varchar(20), -> EmployeeCountryName varchar(20) -> ); Query OK, 0 rows affected (0.62 sec) 使用 insert 插入一些记录 - mysql> insert into DemoTable1431(EmployeeName, EmployeeCountryName) values('Adam Smith', 'AUS'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1431(EmployeeName, EmployeeCountryName) values('Chris Brown', 'US'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1431(EmployeeName, EmployeeCountryName) values('John Doe', 'UK'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1431(EmployeeName, EmployeeCountryName) values('Chris Brown', 'AUS'); Query ... 阅读更多
491 次查看
让我们首先创建一个 - mysql> create table DemoTable1626 -> ( -> Name varchar(20) -> ); Query OK, 0 rows affected (0.37 sec) 使用 insert 插入一些记录 - mysql> insert into DemoTable1626 values('Chris'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1626 values('Bob'); Query OK, 1 row affected (0.34 sec) mysql> insert into DemoTable1626 values('Robert'); Query OK, 1 row affected (0.13 sec) 使用 select 显示表中的所有记录 - mysql> select * from DemoTable1626; 这将产生以下输出 - +--------+ | Name | +--------+ | Chris | | Bob | | ... 阅读更多
635 次查看
为此,您可以结合使用 SUM() 和 CASE 语句。让我们首先创建一个 - mysql> create table DemoTable1430 -> ( -> EmployeeId int, -> isMarried ENUM('YES', 'NO') -> ); Query OK, 0 rows affected (0.60 sec) 使用 insert 插入一些记录 - mysql> insert into DemoTable1430 values(1001, 'Yes'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable1430 values(1001, 'No'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1430 values(1001, 'Yes'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1430 values(1001, 'Yes'); Query OK, 1 row affected (0.16 sec) 显示 ... 阅读更多
浏览量:128
为此,使用MONTH()和DAY()函数。让我们首先创建一个表:−mysql> create table DemoTable1429 -> ( -> AnniversaryDate date -> );使用insert语句插入一些记录:−mysql> insert into DemoTable1429 values('2019-09-29'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1429 values('2018-09-27'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1429 values('2016-09-28'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1429 values('2015-09-29'); Query OK, 1 row affected (0.12 sec)使用select语句显示表中的所有记录:−mysql> select * from DemoTable1429;这将产生以下输出:−+-----------------+ | AnniversaryDate ... 阅读更多