1, the basic command

 

  1. What is a database management system

    1. RDBMS: Relational database relations system

      1. More suitable for high-level requirements for data security and the relationship more complex data NoSQL

    2. NoSQL: non-relational database relational system

      1. Suitable for high performance data storage ,, is generally carried out with the RDBMS used for big data processing, distributed architecture better at

  2. The type of database management system

    1. RDBMS:

      1. MySQL、oracle、msSQL(sql server)、PG

    2. NoSQL: Not Only SQL

    3. 键-值(key-value):Redis、memcached

      1. Document (document): Mongodb

  3. What is a table?

    1. Table: table

    2. Table: table is the basic unit of the database, all data is organized in tabular form, the aim readability

      1. A table comprising rows and columns

        • OK: referred to as data / record (data)

        • Column: is called a field (coolumn)

      2. What attributes of each field should be included?

        Field names, data types, their associated constraints.

  4. Learning mysql mainly learn general sql statement, SQL statements, including add, delete, change, search, SQL statements, how classification

    1. DQL (Data Query Language): query, select all statements are DQL

    2. DML (Data Manipulation Language): insert, delete, update, data tables to add, delete, change.

    3. DDL (Data Definition Language): create, drop, alter, table structure of add, delete, change

    4. TCL (Transaction Control Language): commit to commit the transaction, rollback rolls back the transaction. (TCL T is the Transaction)

    5. DCL (Data Control Language): grant authorization, revoke revoke permissions

  5. Import Data

    • The first step: Sign mysql database management system

      • dos command window:

        mysql -uroot -p111

    • Step Two: to see which database

      show database; (this is not a sql statement, the mysql command)

    • Step 3: Create your own database (bjpowernode)

      create database bjpowernode; (this is not a sql statement, the mysql command)

    • Step Four: Using data bjpowernode

      use bjpowernode (this is not a sql statement, the mysql command)

    • Step five: Check the database which tables currently in use there?

      sql show tables :( This is not a statement, the mysql command)

    • Step Six: initialization data

  6. bjpowernode.sql, this file ends with sql, this file is called "sql script." What is the sql script it?

    When a file extension is .sql. And a large number of documents written in sql statement, we become such a document is "sql script"

    Note: Use direct source command can be executed sql script.

    The amount of data sql scripts too much time, can not open, use the source command initialized.

  7. Delete the database: drop database file name:

  8. View table structure: dexc + table name:

  9. View the data sheet: select * from File Name:

  10. View other tables in the library

    show tables from (library name)

  11. View the table creation statement:

    show create table emp:

  12. In the database is not a null value, did not mean anything, is empty

    Null is not a value can not be measured by an equal sign

    You must use it is null or is not null

  13. Exercises operation

    Login: mysql -uroot -p111

    Show Files: show the file name

    Use file: use the file name:

    View Table: show tables:

    Join table: source + drag the file cmd

 

 

  1. Create a database:

    1. create database database name:

      1. use the database name # create tables in the database, create a table when you must first select the database.

  2. Query the database currently in use:

    1. select database():

    2. Version of the database query: select version ()

  3. Terminate a statement:

    If you want to terminate a statement is being prepared, you can type \ c.

  4. Exit mysql

    1. Using \ q quit or exit

Guess you like

Origin www.cnblogs.com/wn-888/p/11611202.html