In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Introduction to the basics of MySQL database this outline:
A brief introduction to mainstream databases
General classification of database
MySQL database management
First, a brief introduction to mainstream databases
SQL Server (Microsoft products)-- mainly for clients, with very little concurrency
Oriented to Windows operating system
Simple and easy to use
Oracle (Oracle products)
Oriented to Windows operating system
Simple and easy to use
DB2 (IBM products)
For all mainstream platforms
Large, safe and perfect
MySQL (acquired by Oracle)
Free, open source, small size and general classification of databases are mainly divided into relational databases and non-relational databases
relational database system is a database system based on relational model, and its basic concept comes from relational model.
The relational model is based on the theory of relational algebra. The data structure uses a two-dimensional data table that is easy to understand and can be expressed directly by a simple "entity relation" (Emer R) diagram.
The Emurr diagram contains three elements: entities (data objects), relationships and attributes.
Main application examples
Non-relational database
non-relational database, also known as NoSQL (Not Only SQL), stores data without a relational model and does not require a fixed table format.
As a supplement to relational database, non-relational database plays an important role in high efficiency and high performance in the increasingly rapid development of the website era.
is not based on the relational model, but on the Kmuri V relationship (key- key; value- value)
value can also be a specific object (including: attributes, behaviors)
3. MySQL database management 1. Basic management operations
View database list information
show databases
View all data table information in a database
show tables
Display data table structure information
describe [database name]. Table name
2. SQL language
Overview
SQL is the abbreviation of Structured Query Language, that is, structured query language.
A standard language belonging to relational database
Used to maintain and manage databases, such as data query, data update, access control, object management, etc.
classification
DDL: data definition language
DML: data manipulation language
DQL: data query language
DCL: data control language
Specific explanation
DDL statement
is mainly used to create database objects, such as libraries, tables, indexes, etc.
Create database: create database database name; example: create database test; create data table: create table table name (field definition); example: create table users (name char (4) not null,passwd int (10) not null,primary key (name)); delete database: drop database database name; example: drop database test; delete data table: drop table [database name]. Table name; example: drop table test.user; & use test; drop table user
DML statement
is mainly used to manage the data in the table, including the following operations:
INSERT: inserting new data
UPDATE: update existing data
DELETE: delete unwanted data
Insert a new data record: insert into table name (field 1, field 2.) Values (value of field 1, value of field 2.); example: insert into user (name,passwd) values ('zfm',123456); update original data: update table name set field 1 = value 1 [, field name 2 = value 2] where conditional filtering; example: update user set passwd=123 where name='zfmdd'; deletes the specified data record: delete from table name where conditional expression (all records in the table will be deleted without where) instance: delete from test where name='zfmdd'
DQL statement
data query statement, mainly used to find qualified data records in the data table
No condition can be specified when querying: SELECT field name 1, field name 2 FROM table name WHERE conditional expression; example: select * from test where name='zfmdd'; view the first few rows of data: Select * from table limit rows
DCL statement
is mainly used to manage object permissions in the system.
Set user permissions: grant permission list on database name. Table name to user name @ source address [identified by 'password]; example: grant replication test.slave on *. * to' myslave'@'192.168.142.135' identified by 'asd123'; view user rights: show grants for user name @ source address; example: show grants for' myslave'@'192.168.142.135'; revoke user rights: revoke permission list on database name. Table name from user name @ source address; example: revoke replication on test.slave from 'myslave'@'192.168.142.135'
Alternative type
Change the specific field definition in a specific data table: alter table table name modify column field name new definition; add field alter table table name add new field name type (define length) [comment 'comment content to be added']; add keywords "first", "after field name (after a field)" delete field alter table table name drop field name after the type
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.