1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
net start MySQL mysqladmin -u root -p create TUTORIALS mysqladmin -u root -p drop TUTORIALS
mysql -D samp_db -u root -p create database samp_db character set gbk; show databases; use samp_db;
show tables; show columns from students; show index from students; show table status;
create table tutorials_tbl( tutorial_id int not null auto_increment, tutorial_title varchar(100) not null, tutorial_author varchar(40) not null, submission_date date, primary key (tutorial_id) );
show keys from tutorials_tbl where key_name="primary";
insert table tutorials_tbl (tutorial_id, tutorial_title, tutorial_author, submission_date) values (10, "ass", "link", NOW()) insert table tutorials_tbl (tutorial_id, tutorial_title, tutorial_author, submission_date) values (11, "Ass", "link", NOW()) insert table tutorials_tbl (tutorial_id, tutorial_title, tutorial_author, submission_date) values (12, "Asshole", "link", NOW())
select * from tutorials_tbl where tutorial_author="ass"; select * from tutorials_tbl where binary tutorial_author="Ass";
update tutorials_tbl set tutorial_title="Asshole" where binary tutorial_author="Van Darkholme";
delete from tutorials_tbl where tutorial_id=3;
select * from tutorials_tbl where tutorial_author like "%e"; select * from tutorials_tbl where tutorial_author like "e%"; select * from tutorials_tbl where binary tutorial_author like "e%";
select * from tutorials_tbl order by tutorial_author ASC; select * from tutorials_tbl where tutorial_author like "%lme" order by tutorial_author ASC;
select a.tutorial_id, a.tutorial_author, b.tutorial_count from tutorials_tbl a join tcout_tbl b on a.tutorial_author=b.tutorial_author
select a.tutorial_count, a.tutorial_author, b.tutorial_id from tcount_tbl a join tutorials_tbl b on a.tutorial_author=b.tutorial_author;
select a.tutorial_id, a.tutorial_title, b.tutorial_count from tutorials_tbl a left join tcount_tbl b on a.tutorial_author=b.tutorial_author;
select a.tutorial_id, a.tutorial_title, b.tutorial_count from tutorials_tbl a right join tcount_tbl b on a.tutorial_author=b.tutorial_author;
|