当前位置:网站首页>Mysql database (I)
Mysql database (I)
2022-07-05 05:25:00 【Si Xiaoyou】
Catalog
1. Database introduction
# Database content : A warehouse for storing data , Add, delete, modify and query the data in the database
# Data sheet : Where to store data
2. Common databases
# Oracle: A large database of charges
# mysql: Free open source small
# sqlserver: Charging medium-sized database
# db2: Rechargeable
3. Operating the database
# The mouse operation SQL Statement operation
# SQL Code for :
# sql grammar :
# Case insensitive
# Every sentence sql Semicolon after a Inquire about b Inquire about
4. Data types commonly used in databases
# int type The type of number
# varchar(50) character string Indefinite length byte 65535 male 2 Bytes
# char character string Fixed length bytes 255 Bytes male 2 Bytes In the air
# date date Format 'yyyy-mm-dd'
# datetime date Format 'yyyy-mm-dd hh:mm:ss'
5. Commonly used SQL operation
-- notes ctrl+/ add comments of explanations Multiline comment /**/
-- use sql Statement create database grammar : create database Database name
CREATE database ysly;
-- Delete database grammar :drop database Database name ;
drop database ysly;
-- new table
-- grammar
/* create table Table name ( Field name Field type constraint condition , Field name Field type , ... Field name Field type )charset=utf8; */
-- not null Primary key primary key Self increasing default
-- Set the primary key The primary key cannot be empty , Auto increment must be a primary key
-- Which data is the table you created in
create table you.student1(
id int PRIMARY key auto_increment,
name varchar(20) default 'zz',
age int,
sex char(20)
);
-- All fields in the table should be added
-- The new data Grammatical structure insert into Table name values( Field name data , Field name data , Field name data , Field name data )
insert into you.student1 values(1,' Xiaocui ',18,' Woman ');
insert into you.student1 values(' Xiaocui 2',18,' Woman ');
-- Add only some fields
-- insert into Table name ( Field name , Field name , Field name )values( Field data , Field data , Field data )
insert into you.student1(name,age,sex) values(' Xiaocui 2',18,' Woman ');
insert into you.student1(age,sex) values(18,' Woman ');
-- Add multiple data at once values value
-- insert into Table name values( Field name data , Field name data , Field name data , Field name data ),( Field name data , Field name data , Field name data , Field name data ),( Field name data , Field name data , Field name data , Field name data )
insert into you.student1(name,age,sex) value(' Xiaohong ',18,' Woman '),(' Xiaohong 2',18,' Woman '),(' Xiaohong 3',18,' Woman '),(' Xiaohong 3',18,' Woman ');
-- Query statement
-- Inquire about select * from Table name ;
select * from you.student1;
-- Query partial data select Field name , Field name from Table name
select id,name from you.student1;
-- Modify the statement update Table name set Field name = Revised content The entire field of the entire table
update you.student1 set name = ' Cui Hua ';
-- I don't want to modify the fields of the whole table Just want to change the number to 1 Name perhaps Age is 18 Conditions where Conditional
update you.student1 set name = ' Pickled cabbage resembling sauerkraut ' where id = 1;
update you.student1 set name = ' nori ' where age = 30;
-- Delete delete from Table name ;delete from Table name where Conditions ;
delete from you.student1 where id = 2;
delete from you.student1;
-- drop table Table name ; Table structure
drop table you.student1;
-- truncate table Table name ;
truncate you.student;
边栏推荐
- 一个新的微型ORM开源框架
- Warning using room database: schema export directory is not provided to the annotation processor so we cannot export
- [转]:Apache Felix Framework配置属性
- Heap sort summary
- Es module and commonjs learning notes -- ESM and CJS used in nodejs
- PMP考生,请查收7月PMP考试注意事项
- Insert sort
- Optimization scheme of win10 virtual machine cluster
- How can the Solon framework easily obtain the response time of each request?
- room数据库的使用
猜你喜欢

Research on the value of background repeat of background tiling

To the distance we have been looking for -- film review of "flying house journey"

游戏商城毕业设计
![[paper notes] multi goal reinforcement learning: challenging robotics environments and request for research](/img/17/db8614b177f33ee4f67b7d65a8430f.png)
[paper notes] multi goal reinforcement learning: challenging robotics environments and request for research
![[to be continued] [UE4 notes] L3 import resources and project migration](/img/81/6f75f8fbe60e037b45db2037d87bcf.jpg)
[to be continued] [UE4 notes] L3 import resources and project migration

Embedded database development programming (V) -- DQL

Applet Live + e - commerce, si vous voulez être un nouveau e - commerce de détail, utilisez - le!

Reverse one-way linked list of interview questions

Merge sort

Count sort
随机推荐
Yolov5 ajouter un mécanisme d'attention
The next key of win generates the timestamp file of the current day
利用HashMap实现简单缓存
lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
Applet Live + e - commerce, si vous voulez être un nouveau e - commerce de détail, utilisez - le!
使用Electron开发桌面应用
GBase数据库助力湾区数字金融发展
[to be continued] [UE4 notes] L1 create and configure items
Zheng Qing 21 ACM is fun. (3) part of the problem solution and summary
National teacher qualification examination in the first half of 2022
[es practice] use the native realm security mode on es
PMP candidates, please check the precautions for PMP examination in July
Bucket sort
[turn]: Apache Felix framework configuration properties
Warning using room database: schema export directory is not provided to the annotation processor so we cannot export
Introduction to memory layout of FVP and Juno platforms
Solon Logging 插件的添加器级别控制和日志器的级别控制
质量体系建设之路的分分合合
Generate filled text and pictures
MySQL数据库(一)