MySQL Basics (i)

Source: Internet
Author: User

about MySQL

A database is a container for storing organized data.

The database management system DBMS is the software that operates the database.

A table is a structured file that can be used to store specific types of data. Table names in the same database are unique.

A column is a field in a table, and each table is made up of multiple columns. Each column stores a specific type of information, such as employee ID, name, contact, and so on.

The data for each column in the data type (datatype) table has the same data type, which restricts the data type that is stored in the column.

rows (row) are also known as records, and horizontal rows in a table.

primary key (primary key), a column in a table whose value uniquely distinguishes each row in a table. For example, the ID of the employee, the ID of the commodity order. The primary key value is not allowed to be a null value.

SQL(Structured query Language) Structured Query language that is specifically designed to communicate with the database.

Working with databases
    1. Connect to Native Database: command line input mysql -u root -p , then enter the password
    2. Display database: Show DATABASES; , select database: Use simpledb; , display table: Show TABLES; Show table column: Show Column S from customers;
Retrieving data
  1. To retrieve a single column:
    SELECT prod_name      from the products;

    The returned result is unordered

  2. When retrieving multiple columns, add a comma between the column names:
    SELECT prod_name, Prod_price      from the products;

  3. Retrieve all columns and use wildcards to complete:
    SELECT *     from the products;

    The biggest bit of the wildcard is the column that is retrieved so far

  4. Retrieve different lines, keyword distinct:
    SELECT DISTINCT vend_id      from the products;

  5. Search for restricted results:
    SELECT prod_name      from Products ;     5,5;

    Instructs MySQL to retrieve 5 lines starting at line 5, Note that the first row retrieved is 0 instead of 1

Sort Retrieve data

MySQL Basics (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.