mysql技术内幕_学习笔记_20130206

37/908

SELECT NOW();
SELECT NOW() \g

40/908

CREATE DATABASE sampdb;
use sampdb;

42/908

CREATE TABLE president
(
   last_name  VARCHAR(15) NOT NULL,
   first_name VARCHAR(15) NOT NULL,
   suffix     VARCHAR(5)  NULL,
   city       VARCHAR(20) NOT NULL,
   state      VARCHAR(2)  NOT NULL,
   birth      DATE        NOT NULL,
   death      DATE        NULL
);

57/908

 mysql sampdb < insert_president.sql

59/908

select * from president;
select birth from president where last_name = 'Eisenhower';

142/908

select * from score where event_id in (select event_id from grade_event where category = 'T');
143/908
select * from score where event_id = (select event_id from grade_event
where date = '2008-09-23' and category = 'Q');
select * from president where birth = (select min(birth) from president);
select last_name, first_name, city, state from president
where (city, state) = 
(select city, state from president
where last_name = 'Adams' and first_name = 'John');

144/908

select * from student where student_id in (select student_id from absence);

489/908

show variables like 'datadir';


你可能感兴趣的:(mysql技术内幕_学习笔记_20130206)