找到 4219 篇文章 关于 MySQLi
405 次浏览
让我们首先创建一个表 - mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(40), StudentMathMarks int, StudentMySQLMarks int, status ENUM('ACTIVE', 'INACTIVE') ); Query OK, 0 rows affected (0.47 sec)插入一些记录到表中使用 insert 命令 - mysql> insert into DemoTable(StudentName, StudentMathMarks, StudentMySQLMarks, status) values('Chris', 45, 67, 'active'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable(StudentName, StudentMathMarks, StudentMySQLMarks, status) values('Bob', 89, 78, 'inactive'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable(StudentName, StudentMathMarks, StudentMySQLMarks, status) values('David', 56, 68, 'active'); Query OK, 1 row affected ... 阅读更多
3K+ 次浏览
BIGINT 和 BIGINT(20) 之间的唯一区别在于显示宽度。20 可用于显示宽度。让我们看一个示例并创建一个表。在这里,我们设置了 BIGINT(20) - mysql> create table DemoTable ( Number bigint(20) zerofill ); Query OK, 0 rows affected (0.58 sec)插入一些记录到表中使用 insert 命令 - mysql> insert into DemoTable values(1); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values(12); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(123); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(1234); Query OK, ... 阅读更多
163 次浏览
让我们首先创建一个表 - mysql> create table DemoTable ( Name varchar(40) ); Query OK, 0 rows affected (0.55 sec)插入一些记录到表中使用 insert 命令 - mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('Sam'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Mike'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('Ethan'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('Johnson'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('Bob'); Query OK, 1 row affected ... 阅读更多
100 次浏览
为此,使用 LEFT() 方法。为了操作,我们使用了 LOCATE() 和 REVERSE() 方法。让我们首先创建一个表 - mysql> create table DemoTable ( Title text ); Query OK, 0 rows affected (0.52 sec)插入一些记录到表中使用 insert 命令 - mysql> insert into DemoTable values('$/This$is[MySQL]$/MySQL[FirstClass]$MySQL[SecondClass]'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('$/This$is[Java]$/Java[FirstClass]$Java[SecondClass]'); Query OK, 1 row affected (0.10 sec)显示表中所有记录使用 select 语句 - mysql> select *from DemoTable;这将产生以下输出 -+--------------------------------------------------------+ | Title ... 阅读更多
102 次浏览
对于此类字符串操作,您需要使用 MySQL SUBSTRING_INDEX()。让我们首先创建一个表 - mysql> create table DemoTable ( SystemIpAddress text ); Query OK, 0 rows affected (0.58 sec)插入一些记录到表中使用 insert 命令 - mysql> insert into DemoTable values('192.168.130.67'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('192.168.130.87'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('192.168.131.47'); Query OK, 1 row affected (0.31 sec) mysql> insert into DemoTable values('192.168.134.50'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('192.168.131.12'); Query OK, 1 row affected (0.21 sec)显示 ... 阅读更多
109 次浏览
不需要插入 auto_increment 列值,因为它从 1 开始并自行插入。这是因为我们将其设置为自动递增。让我们首先创建一个表 - mysql> create table DemoTable ( EmployeeId int NOT NULL AUTO_INCREMENT, EmployeeName varchar(30), EmployeeSalary int, PRIMARY KEY(EmployeeId) ); Query OK, 0 rows affected (0.49 sec)插入一些记录到表中使用 insert 命令 - mysql> insert into DemoTable(EmployeeName, EmployeeSalary) values('Chris', 56789); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(EmployeeName, EmployeeSalary) values('David', 78909); Query OK, 1 row affected (0.14 sec) mysql> ... 阅读更多
343 次浏览
让我们首先创建一个表 - mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, Score int ); Query OK, 0 rows affected (0.45 sec)插入一些记录到表中使用 insert 命令 - mysql> insert into DemoTable(Score) values(56); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable(Score) values(78); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable(Score) values(34); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable(Score) values(55); Query OK, 1 row affected (0.37 sec)显示表中所有记录使用 select 语句 - mysql> select *from DemoTable;这将 ... 阅读更多
377 次浏览
为此,使用 FLOOR() 函数。在这里,我们将从包含 5.23、8.76、12.00、22.68 等记录的列表中获取 12.00、35.00 等记录。让我们首先创建一个表 - mysql> create table DemoTable ( Value DECIMAL(4, 2) ); Query OK, 0 rows affected (0.53 sec)插入一些记录到表中使用 insert 命令 - mysql> insert into DemoTable values(54.20); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(55.0); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable values(7.8); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(9.0); Query OK, ... 阅读更多
1K+ 次浏览
让我们首先创建一个表 - mysql> create table DemoTable ( Marks int ); Query OK, 0 rows affected (0.62 sec)插入一些记录到表中使用 insert 命令 - mysql> insert into DemoTable values(88); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values(65); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(98); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(45); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(67); Query OK, 1 row affected (0.33 sec)显示表中所有记录使用 select 语句 - mysql> select ... 阅读更多
408 次浏览
为此使用 DELETE。让我们首先创建一个表 - mysql> create table DemoTable ( Name varchar(40), Score1 int , Score2 int ); Query OK, 0 rows affected (2.71 sec)插入一些记录到表中使用 insert 命令 - mysql> insert into DemoTable values('John', 56, 76); Query OK, 1 row affected (0.66 sec) mysql> insert into DemoTable values('Chris', 77, 77); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('David', 89, 98); Query OK, 1 row affected (0.13 sec)显示表中所有记录使用 select 语句 - mysql> select *from DemoTable;这将产生以下输出 ... 阅读更多