找到 4219 篇文章 关于 MySQLi
727 次浏览
让我们首先创建一个表 - mysql> create table DemoTable1908 ( Code text ); Query OK, 0 rows affected (0.00 sec) 使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable1908 values('MySQL(1)Database'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1908 values('MongoDB 2 Database'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1908 values('MySQL(3)Database'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1908 values('SQL Server(10)Database'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1908 values('MySQL 8 Database'); Query OK, 1 row affected (0.00 sec) 显示所有记录从 ... 阅读更多
131 次浏览
让我们首先创建一个表 - mysql> create table DemoTable1907 ( UserId int NOT NULL AUTO_INCREMENT, UserName varchar(20), UserAge int, UserCountryName varchar(20), PRIMARY KEY(UserId) )ENGINE=MyISAM, AUTO_INCREMENT=100; Query OK, 0 rows affected (0.00 sec) 使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable1907(UserName, UserAge, UserCountryName) values('Chris', 26, 'US'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1907(UserName, UserAge, UserCountryName) values('David', 38, 'UK'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1907(UserName, UserAge, UserCountryName) values('John', 28, 'AUS'); Query OK, 1 row affected (0.00 sec) 显示所有记录从 ... 阅读更多
423 次浏览
要更改日期格式,请使用 DATE_FORMAT() 函数。让我们首先创建一个表 - mysql> create table DemoTable1906 ( DueTime datetime ); Query OK, 0 rows affected (0.00 sec) 使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable1906 values(now()); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1906 values(curdate()); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1906 values('2017-10-11'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1906 values('2015-01-12'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1906 values('2018-04-25'); Query OK, 1 row affected (0.00 ... 阅读更多
298 次浏览
要加快此过程,可以使用索引。让我们首先创建一个表 - mysql> create table DemoTable1905 ( FirstName varchar(20), LastName varchar(20) , INDEX F_L_Name(FirstName, LastName) ); Query OK, 0 rows affected (0.00 sec) 使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable1905 values('John', 'Smith'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1905 values('John', 'Doe'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1905 values('Adam', 'Smith'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1905 values('John', 'Doe'); Query OK, 1 row affected (0.00 sec) ... 阅读更多
338 次浏览
要转义反斜杠,请在插入记录时使用 PreparedStatement。让我们首先创建一个表 - mysql> create table DemoTable1904 ( ClientId int, ClientName varchar(20), ClientAge int ); Query OK, 0 rows affected (0.00 sec) Java 代码如下 - import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; public class EscapeBackslashesDemo { public static void main(String[] args) { Connection con = null; PreparedStatement ps = null; try { con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/web?" + "useSSL=false", "root", "123456"); String query = "insert into DemoTable1904(ClientId, ... 阅读更多
223 次浏览
让我们首先创建一个表 - mysql> create table DemoTable1903 ( FirstName varchar(20), LastName varchar(20) , Age int ); Query OK, 0 rows affected (0.00 sec) 使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable1903 values('John', 'Smith', 23); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1903 values('None', 'Miller', 28); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1903 values('None', 'Taylor', 26); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1903 values('Chris', 'Brown', 26); Query OK, 1 row affected (0.00 sec) 显示所有记录从表中 ... 阅读更多
545 次浏览
为此,请使用 REGEXP。让我们首先创建一个表 - mysql> create table DemoTable1902 ( Subjects text ); Query OK, 0 rows affected (0.00 sec) 使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable1902 values('MongoDB, Java, Python'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1902 values('SQL Server, MySQL, PL/SQL'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1902 values('Hibernate, Spring, JPA'); Query OK, 1 row affected (0.00 sec) 使用 select 语句显示表中的所有记录 - mysql> select * from DemoTable1902; 这将产生以下输出 - +-------------------------+ | Subjects ... 阅读更多
552 次浏览
为此,您可以使用 INSERT INTO SELECT 语句。让我们首先创建一个表 - mysql> create table DemoTable1900 ( ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY, ClientName varchar(20), ClientAge int default 29 ) auto_increment=1000; Query OK, 0 rows affected (0.00 sec) 使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable1900(ClientName, ClientAge) values('Chris', 45); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1900(ClientName, ClientAge) values('David', 29); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1900(ClientName, ClientAge) values('Mike', 37); Query OK, 1 row affected (0.00 sec) mysql> insert into ... 阅读更多
308 次浏览
要替换特定字符,请使用 REPLACE(),要更新,请使用 UPDATE 命令。让我们首先创建一个表 - mysql> create table DemoTable1899 ( Code varchar(20) ); Query OK, 0 rows affected (0.00 sec) 使用 insert 命令在表中插入一些记录 - mysql> insert into DemoTable1899 values('John_123'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1899 values('32189_Sam_987'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1899 values('Miller_David_456_909'); Query OK, 1 row affected (0.00 sec) 使用 select 语句显示表中的所有记录 - mysql> select * from DemoTable1899; 这将产生以下输出 ... 阅读更多
308 次浏览
首先,让我们创建一个表:
mysql> create table DemoTable1898 ( Number int );
Query OK, 0 rows affected (0.00 sec)
使用insert命令在表中插入一些记录:
mysql> insert into DemoTable1898 values(10);
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1898 values(70);
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1898 values(30);
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1898 values(50);
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1898 values(40);
Query OK, 1 row affected (0.00 sec)
使用select语句显示表中的所有记录... 阅读更多