找到 4219 篇文章 关于 MySQLi
2K+ 次浏览
为此,使用 UNION ALL。让我们首先创建一个表:mysql> create table DemoTable729 ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(100), MySQLMarks int, CMarks int, JavaMarks int ); Query OK, 0 rows affected (0.40 sec)使用 insert 命令在表中插入一些记录:mysql> insert into DemoTable729(StudentName, MySQLMarks, CMarks, JavaMarks) values('Chris', 94, 67, 75); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable729(StudentName, MySQLMarks, CMarks, JavaMarks) values('Robert', 45, 99, 54); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable729(StudentName, MySQLMarks, CMarks, JavaMarks) values('David', 57, 89, 43); Query OK, 1 row ... 阅读更多
305 次浏览
英国日期格式支持日-月-年的格式。要将其转换为 MySQL 日期,请使用 STR_TO_DATE()。以下是语法:select str_to_date(yourColumnName, '%d/%m/%Y') from yourTableName;让我们首先创建一个表:mysql> create table DemoTable728 (DueDate varchar(100)); Query OK, 0 rows affected (0.59 sec)使用 insert 命令在表中插入一些记录:mysql> insert into DemoTable728 values('10/11/2019'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable728 values('31/01/2016'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable728 values('01/12/2015'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable728 values('11/03/2018'); Query OK, 1 row affected (0.16 sec)显示表中的所有记录 ... 阅读更多
118 次浏览
为此,您可以使用 IN()。让我们首先创建一个表:mysql> create table DemoTable727 ( Name varchar(100), Score int ); Query OK, 0 rows affected (0.88 sec)使用 insert 命令在表中插入一些记录:mysql> insert into DemoTable727 values('Chris', 45); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable727 values('Robert', 89); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable727 values('Carol', 94); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable727 values('David', 93); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable727 values('Mike', 78); Query OK, 1 row affected (0.21 ... 阅读更多
461 次浏览
让我们首先创建一个表 - mysql> create table DemoTable726 (Value varchar(100)); Query OK, 0 rows affected (0.60 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable726 values('100'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable726 values('10'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable726 values('110'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable726 values('2000'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable726 values('1000'); Query OK, 1 row affected (0.14 sec)使用 select 语句显示表中的所有记录 - mysql> select *from DemoTable726;这将 ... 阅读更多
95 次浏览
要计算数字的幂,请使用 POWER() 函数。让我们首先创建一个表 - mysql> create table DemoTable ( Amount int ); Query OK, 0 rows affected (0.89 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable values(64); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values(144); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values(400); Query OK, 1 row affected (0.13 sec)使用 select 语句显示表中的所有记录 - mysql> select *from DemoTable;这将产生以下输出 - +--------+ | Amount | ... 阅读更多
1K+ 次浏览
你不能在表名中使用下划线。如果你仍然想创建一个包含下划线的表,请用反引号括起来,而不是单引号。但是,让我们首先尝试在包含下划线的表名周围设置引号。以下是一个示例 - mysql> create table 'Demo_Table725'( ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY, ClientName varchar(100), ClientAge int, ClientCountryName varchar(100), isMarried boolean );这将产生以下输出,即错误,因为我们没有使用反引号 - ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ... 阅读更多
920 次浏览
让我们首先创建一个表 - mysql> create table DemoTable724 (Value int); Query OK, 0 rows affected (0.79 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable724 values(101); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable724 values(183); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable724 values(983); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable724 values(234); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable724 values(755); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable724 values(435); Query OK, 1 row affected (0.28 sec) mysql> ... 阅读更多
390 次浏览
让我们首先创建一个表 - mysql> create table DemoTable723 (Value int); Query OK, 0 rows affected (0.58 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable723 values(100); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable723 values(200); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable723 values(200); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable723 values(100); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable723 values(300); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable723 values(400); Query OK, 1 row affected (0.16 sec) mysql> ... 阅读更多
356 次浏览
让我们首先创建一个表 - mysql> create table DemoTable(DueDate varchar(100)); Query OK, 0 rows affected (0.78 sec)使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable values('10-01-2019 10:19:20'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('12-03-2018 11:00:00'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('02-23-2018 04:20:40'); Query OK, 1 row affected (0.19 sec)使用 select 语句显示表中的所有记录 - mysql> select *from DemoTable;这将产生以下输出 - +---------------------+ | DueDate | +---------------------+ | 10-01-2019 10:19:20 | | 12-03-2018 11:00:00 ... 阅读更多