程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Introduction to Python development learning notes SQL statement

編輯:Python

The point of this section

Understand the role of the database
Master concept base 、 surface 、 Record
The duration of this section needs to be controlled 15 Within minutes

First time to know sql sentence

With mysql This database software , The programmer can be freed from the management of data , Focus on programming logic

mysql The server software is mysqld Help us manage our files and folders , The premise is that we as users , Need to download mysql The client of , Or other modules to connect to mysqld, And then use mysql Submit your own commands in the syntax format specified by the software , Realize the management of folder or file . The syntax is sql(Structured Query Language Structured query language )

SQL Language is mainly used to access data 、 Query data 、 Updating data and managing relational database systems ,SQL Language by IBM Development .SQL Language is divided into 3 Types :
1、DDL sentence Database definition language : database 、 surface 、 View 、 Indexes 、 stored procedure , for example CREATE DROP ALTER

2、DML sentence Database manipulation language : insert data INSERT、 Delete data DELETE、 Update data UPDATE、 Query data SELECT

3、DCL sentence Database control language : For example, controlling user access GRANT、REVOKE

1. Operation folder

 increase :create database db1 charset utf8;
check :show databases;
Change :alter database db1 charset latin1;
Delete : drop database db1;

2. Operation file

 Switch to the folder first :use db1
increase :create table t1(id int,name char);
check :show tables
Change :alter table t1 modify name char(3);
alter table t1 change name name1 char(2);
Delete :drop table t1;

3. Manipulate the contents of the file / Record

 increase :insert into t1 values(1,'egon1'),(2,'egon2'),(3,'egon3');
check :select * from t1;
Change :update t1 set name='sb' where id=2;
Delete :delete from t1 where id=1;

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved