The relationship between database (DB), database management system (DBMS), MySQL, SQL

Table of contents

1. Database (DB)

1. Advantages of the database

2. Characteristics of database storage data

2. Database Management System (DBMS)

3.MySQL

1. Advantages of MySQL

2. The disadvantages of MySQL

3. Use MySQL

Four.SQL

1. Advantages of SQL

2. Classification

3. Grammar specification

5. Contact


1. Database (DB)

database: A container for organized data, usually a file or set of files. A database is equivalent to a warehouse for organized collection and storage of data.

1. Advantages of the database

  • overall data structuring
  • High data sharing, low redundancy and easy expansion
  • High data independence
  • The data is uniformly managed and controlled by the database management system

2. Characteristics of database storage data

  • Put the data into the table, and then put the table into the library
  • There can be many kinds of tables in a database, and each table has its own name to identify itself. Table names are unique.
  • Tables have properties that define how data is stored in the table, similar to the design of "classes" in Java.
  • Tables are made up of columns, which we also call fields. All tables are composed of one or more columns, and each column is similar to an "attribute" in Java.
  • The data in the table is stored in rows, and each row is similar to an "object" in Java.

2. Database Management System (DBMS)

Database Management System (DataBase Management System): A program that manages a database. Common database management systems include: Oracle, MySQL, DB2, SQLServer, SyBase, SQLite, etc.

A previous blog has written about DBMS in detail: Database Management System (DBMS) . Those who are interested can take a look.

3.MySQL

MySQL: A database management system.

1. Advantages of MySQL

  • Small, fast, low total cost of ownership, and open source.
  • Multiple operating systems are supported.
  • It is an open source database, and the interface provided supports multi-language connection operations.
  • The core program of MySql adopts complete multi-thread programming. Threads are lightweight processes that flexibly provide services to users without overwhelming system resources. MySql implemented with multithreading and C language can easily make full use of the CPU.
  • MySql has a very flexible and secure permission and password system. When clients connect to the MySql server, all password transmissions between them are encrypted, and MySql supports host authentication.
  • Support ODBC for Windows, support all ODBC 2.5 functions and many other functions, and can use Access to connect to MySql server, so that the application can be extended.
  • Supports large databases, and can easily support databases with tens of millions of records. As an open source database, it can be modified for different applications.
  • Has a very fast and stable thread-based memory allocation system that can be used continuously without worrying about its stability.
  • MySQL also provides a high degree of diversity and can provide many different user interfaces, including command-line client operations, web browsers, and various programming language interfaces, such as C++, Perl, Java, PHP, and Python. You can use a pre-packaged client, or simply write a suitable application yourself. MySQL is available on platforms such as Unix, Windows, and OS/2, so it can be used on a personal computer or a server.

2. The disadvantages of MySQL

  • Hot backups are not supported.
  • The security system is complex rather than standard, and changes only when mysqladmin is called to reread user privileges.
  • There is no one stored procedure (Stored Procedure) language.
  • The price of MySQL varies by platform and installation method. MySQL for Linux is free if installed by the user himself or the system administrator rather than a third party, and the third option must pay a license fee. Unix or Linux self-installation is free, Unix or Linux third-party installation charges.

3. Use MySQL

The installation of MySQL will not be described in detail.

  • run cmd as administrator
  • net start service name (start service)
  • net stop service name (stop service)
  • mysql -h host name -P port number -u user name -p password (if you log in to the local database, the host port number can be omitted; -p can be followed by the password, and then write after a new line)

Of course, you can also install a GUI client.

Four.SQL

SQL (Structured Query Language): It is a structured query language. SQL is a language designed to communicate with databases. Almost all important DBMSs support SQL. DBMSs operate databases by executing SQL, and the SQL implemented by any two DBMSs is not exactly the same (the SQL language also has dialects).

1. Advantages of SQL

  • Not a language proprietary to a particular database vendor, almost all DBMS (database software) support SQL.
  • Easy to learn (compared with java, c, c++, etc., the syntax is simple and easy to use).
  • Although simple, it is actually a powerful language that can be used flexibly to perform very complex and advanced database operations.

2. Classification

  • DQL: data query language, used to query data records → select query.
  • DML: data manipulation language, used to modify data records→delete/truncate deletion, update modification, insert addition.
  • DDL: Used to define the structure of the database/table, such as creating, modifying or deleting database objects/tables → create creation, alter modification, drop deletion (abandoned).
  • DCL: Database Control Language, used to set or change database users, role permissions → GRANT authorization, REVOKE deauthorization.
  • TCL: Transaction Control Language, used to control database access → COMMIT commit, ROLLBACK rollback, SAVEPOINT set savepoint, SET TRANSACTION change transaction options.
  • CCL: Pointer Control Language, used for operations on individual rows of one or more tables → DECLARE CURSOR, FETCH INTO and UPDATE WHERE CURRENT (this language is less used).

3. Grammar specification

  • The language is not case-sensitive, but the convention is to capitalize keywords, indicate, and lowercase lists.
  • Each command needs to end with ";" or "/g".
  • Each command can be indented or wrapped as needed.
  • Comment: single-line comment: "# comment text" or "-- comment text" (with spaces in between)
               multi-line comment: /* comment text */

5. Contact

  • data stored in the database
  • We manage data through a database management system (DBMS)
  • MySQL is a type of DBMS
  • When we have operational requirements for data (addition, deletion, modification and query), tell our DBMS through SQL language

Guess you like

Origin blog.csdn.net/senxu_/article/details/126900207