找到 4219 篇文章 关于 MySQLi
479 次浏览
让我们先创建一个表:mysql> create table DemoTable -> ( -> FirstName varchar(100), -> Age int, -> Score int -> ); Query OK, 0 rows affected (0.62 sec) 使用insert命令在表中插入一些记录:mysql> insert into DemoTable values('Robert', 21, 78); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('Bob', 20, 90); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values('Sam', 22, 69); Query OK, 1 row affected (0.20 sec) 使用select语句显示表中的所有记录:mysql> select *from DemoTable;输出+-----------+------+-------+ | ... 阅读更多
1K+ 次浏览
使用BETWEEN和INTERVAL来实现这一点。让我们先创建一个表:mysql> create table DemoTable -> ( -> AdmissionDate date -> ); Query OK, 0 rows affected (0.84 sec) 使用insert命令在表中插入一些记录:mysql> insert into DemoTable values('2019-09-30'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('2019-10-01'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('2019-03-30'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values('2019-04-24'); Query OK, 1 row affected (0.17 sec) 使用select语句显示表中的所有记录... 阅读更多
97 次浏览
为此,使用以下语法,其中我们使用了SHOW GRANTS:SHOW GRANTS FOR 'yourUserName'@'yourHostName'; HostName可以是’%’或localhost。让我们实现上述语法以显示ROOT的权限:mysql> SHOW GRANTS FOR 'root'@'%' ;输出+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Grants for root@% ... 阅读更多
202 次浏览
您可以使用TIME_FORMAT()。让我们先创建一个表:mysql> create table DemoTable -> ( -> PunchIn time, -> PunchOut time, -> Launch time -> ); Query OK, 0 rows affected (0.50 sec) 使用insert命令在表中插入一些记录:mysql> insert into DemoTable values('9:00', '6:00', '1:00:00'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('9:30', '6:10', '00:30:00'); Query OK, 1 row affected (0.21 sec) 使用select语句显示表中的所有记录:mysql> select *from DemoTable;输出+----------+----------+----------+ | PunchIn | PunchOut | Launch | +----------+----------+----------+ | 09:00:00 | ... 阅读更多
108 次浏览
为此,使用substring_index()方法。让我们先创建一个表:mysql> create table DemoTable -> ( -> FolderName varchar(100), -> FolderLocation varchar(200) -> ); Query OK, 0 rows affected (1.03 sec) 使用insert命令在表中插入一些记录:mysql> insert into DemoTable values('CProgram', 'C:/AllPrograms/.....'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Images', 'E:/MyImage/home/garbage'); Query OK, 1 row affected (0.15 sec) 使用select语句显示表中的所有记录:mysql> select *from DemoTable;输出+------------+-------------------------+ | FolderName | FolderLocation | +------------+-------------------------+ | CProgram | C:/AllPrograms/..... ... 阅读更多
119 次浏览
您可以使用MySQL的DATE_ADD()函数。让我们先创建一个表:mysql> create table DemoTable -> ( -> ShippingDate varchar(100) -> ); Query OK, 0 rows affected (0.67 sec) 使用insert命令在表中插入一些记录:mysql> insert into DemoTable values('06-01-2019'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('01-04-2017'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('29-06-2019'); Query OK, 1 row affected (0.47 sec) 使用select语句显示表中的所有记录:mysql> select *from DemoTable;输出+--------------+ | ShippingDate | +--------------+ | 06-01-2019 | ... 阅读更多
117 次浏览
让我们先创建一个表:mysql> create table DemoTable -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentScore varchar(100) -> ); Query OK, 0 rows affected (0.66 sec) 使用insert命令在表中插入一些记录:mysql> insert into DemoTable(StudentScore) values('90'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable(StudentScore) values('100'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(StudentScore) values('56'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable(StudentScore) values('98'); Query OK, 1 row affected (0.13 sec) 显示表中的所有记录... 阅读更多
237 次浏览
让我们先创建一个表:mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(100), -> Age int -> ); Query OK, 0 rows affected (0.49 sec) 使用insert命令在表中插入一些记录:mysql> insert into DemoTable(Name, Age) values('Robert', 24); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable(Name, Age) values('Chris', 22); Query OK, 1 row affected (0.13 sec) 使用select语句显示表中的所有记录:mysql> select *from DemoTable;输出+----+--------+------+ | Id | Name | Age | +----+--------+------+ ... 阅读更多
102 次浏览
让我们先创建一个表:mysql> create table DemoTable -> ( -> Name varchar(100), -> DueDate datetime -> ); Query OK, 0 rows affected (0.54 sec) 使用insert命令在表中插入一些记录。假设当前日期是“2019-07-05”:mysql> insert into DemoTable values('Chris', '2019-06-24'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('Chris', '2018-01-01'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Robert', '2019-07-05'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values('Carol', '2019-08-03'); Query OK, 1 row affected (0.22 ... 阅读更多
231 次浏览
为此,使用 CONCAT() 函数连接日期和时间。让我们首先创建一个表 - mysql> create table DemoTable -> ( -> ShippingDate date, -> ShippingTime time, -> ShippingDatetime datetime -> ); Query OK, 0 rows affected (0.50 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable(ShippingDate, ShippingTime) values('2019-01-10', '10:40:20'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(ShippingDate, ShippingTime) values('2019-06-14', '04:00:10'); Query OK, 1 row affected (0.14 sec)使用 select 语句显示表中的所有记录 - mysql> select *from DemoTable;输出+--------------+--------------+------------------+ | ShippingDate | ShippingTime | ... 阅读更多