From getting started to proficient in MYsql databases (2) _ MySQL

Source: Internet
Author: User
From getting started to proficient in MYsql database Learning Experience (2) bitsCN.com num ('F', 'M') not null,
Student_id int unsigned not null auto_increment primary key
)
Create table absence
(
Student_id int unsigned not null,
Date not null,
Primary key (student_id, date)
)
7. add new records
Mysql> insert into student values ('Kyle ', 'M', null );
Insert into table_name values (...),(...);
Insert into member (last_name, fist_name) values ('stamp', 'Kelly ');
Insert into student (name, sex) values ('abbly', 'F'), ('Lily', 'M ');
Insert into member set last_name = 'stein ', fist_name = 'Waldo ';
Another way to load records into a table is to directly read data values from the file. You can use the load data statement or the mysqlimport utility to LOAD Records. The load data statement is used to LOAD programs in batches. it reads DATA from a file.
Load data local infile "member.txt" into table member;
Mysqlimport .. lacal samp_db member.txt
  
8. search information
Select * from president
Select birth_date from president where last_name = "esihower ";
To write a SELECT statement, you only need to specify what needs to be retrieved, and then SELECT some clauses. The clauses "FROM" and "WHERE" just given are the most commonly used. There are also some other clauses, such as group by, order by, and LIMIT. The FROM clause is generally provided, but it is not provided if data is not selected FROM the table. For example, the following query only displays values of some expressions that can be directly calculated without referencing any tables. Therefore, the FROM clause is not required:
Mysql> select 2 + 2, "hello, world", version ();
If only one column is selected:
Select name from student;
Select name, sex, student_id from student; bitsCN.com

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.