ղ | Ϊҳ | Ա | ҪͶ հ https://www.dakongjun.com/- Ƽվ顢Ƽ㡢5G,վ!
ǰλã ҳ > վѧԺ > MySql̳ >

3Pythonȫջ֮·ϵ֮MySQL

ʱ䣺2022-07-09 16:07:12 ĿMySql̳ Դ
ȴһڲ -- ݿ CREATE DATABASE dbname DEFAULT CHARSET utf8 COLLATE utf8_general_ci; -- CREATE TABLE `tb` ( `id` int(5) NOT NULL AUTO_INCREMENT, `name` char(15) NOT NULL, `alias` varchar(10) DEFAULT NULL, `email
ȴһڲ
 
-- ݿ
CREATE DATABASE dbname DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
--
CREATE TABLE `tb` (
 `id` int(5) NOT NULL AUTO_INCREMENT,
 `name` char(15) NOT NULL,
 `alias` varchar(10) DEFAULT NULL,
 `email` varchar(30) DEFAULT NULL,
 `password` varchar(20) NOT NULL,
 `phone` char(11) DEFAULT '13800138000',
 PRIMARY KEY (`id`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ӱ
dbnameݿ
mysql> use dbname
Database changed
# 鿴ǰеı
mysql> show tables;
+------------------+
| Tables_in_dbname |
+------------------+
| tb               |
+------------------+
1 row in set (0.00 sec)
# 鿴tbڵ
mysql> select * from tb;
Empty set (0.00 sec)
-- 뵥
insert into tb(name,email,password) values("ansheng","anshengme.com@gmail.com","as");
-- ͬʱ
insert into tb(name,email,password) values("as","i@anshengme.com","pwd"),("info","info@anshengme.com","i");

  
mysql> select id,name as username from tb where id > 4;
+----+----------+
| id | username |
+----+----------+
|  5 | hello    |
|  6 | word     |
|  7 | python   |
+----+----------+
3 rows in set (0.00 sec)

༭հ

վݾ磬۽߸˹۵㣬վַȨ뼰ʱϵվɾ!