Web Design and Programming Pt 18

MySQL StatementsIn this video tutorial I cover how to do numerous things with MySQL. I show you how to:

  • Join Data in Tables
  • Create Indexes
  • Delete Indexes
  • Change Column Data Types
  • Change Table Names
  • Create Full Text Indexes
  • Change Data in Columns
  • Perform Full Text Searches

And a bunch more…

All of the MySQL statements follow the video. If you have any questions or comments leave them below.

In the next tutorial I’ll be getting into how to use MySQL with PHP.

SQL Statements from the Video

select prod_type,pt_id from product_id;

describe manufacturer_id;
describe model_numbers;

describe manufacturer_id;describe model_numbers;

SELECT DISTINCT Manufacturer_ID.Manufacturer,Manufacturer_ID.Man_ID FROM Manufacturer_ID, Model_Numbers

WHERE ((Manufacturer_ID.Man_ID = Model_Numbers.Man_ID) AND (Model_Numbers.PT_ID = 45)) order by Manufacturer;

use customer;

show tables;

describe customer;

alter table customer add index state_id (state_id);

describe customer;

alter table customer add index phone_id(phone_id);

drop index state_id on customer;

alter table customer add UNIQUE state_id(state_id);

drop index state_id on customer;

alter table customer add index state_id (state_id);

describe customer;

alter table customer add index order_id(order_id);

create index index_name on tbl_name(columnsToIndex);

alter table customer add column comments varchar(40);

describe customer;

alter table customer change column comments comments text;

describe customer;

alter table customer rename as newTableName;

alter table customer add fulltext index (comments);

show create table customer \G

select * from customer;

describe phone;

insert into phone values (NULL, ‘412-876-7878′,’Work’);

insert into customer values(‘Sally’,’Smith’,’234 Main St’,’Happy Town’,3,15234,SHA(‘Monkey2′),2,NULL,NULL,’Really nice lady who loves cats’);

update customer set comments=’Crazy man who has 2 cats named Peekaboo and Sophie’ where cust_id=1;

insert into customer values(‘Paul’,’Smith’,’234 Main St’,’Happy Town’,3,15234,SHA(‘pw1234′),2,NULL,NULL,’Sally Smiths husband he wants a dog’);

select first_name, comments from customer where match (comments) against (‘crazy’);

insert into customer values(‘Mark’,’Marks’,’194 South St’,’Happy Town’,3,15234,SHA(‘abc1234′),3,NULL,NULL,’Craziest man I ever met. Loves dogs’);

select first_name, last_name, comments from customer where match(comments) against(‘craz*’ in boolean mode);

select first_name, last_name, comments from customer where match(comments) against(‘+craz* -cat*’ in boolean mode);

Leave a Reply

Your email address will not be published.

Google+