Learn simple database table operations (MYSQL) 2

Source: Internet
Author: User

Take the person table as an example under the ORCL instance:

1. Log in to MySQL:

MySQL installation path, bin directory, Open command window, enter mysql-u user name-p password;

2. Show all instances, show databases;

3. Enter ORCL instance, use ORCL;

4. Display the Person table field information, desc person;

5. Modify the field description, ALTER TABLE person change PID pid Int (one) not null;

6. Modify the table name, ALTER TABLE person rename to people;

7. Check, select *from person;

8. Add, insert into person (name,age,birthday,salary) VALUES (' Ming ', 11, ' 1999-01-01 ', 1000);

9. Change, update person set name = ' Xiaoli ' where pid = 11;

10. Delete from the person where PID = 10;

11. Number, select COUNT (1), age from person group by age;

12. Sort, select name,salary from Person order by salary ASC;

Select Name,salary from person order by salary desc;

Learn simple database table operations (MYSQL) 2

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.