# mysql -v -v -v -u yourusername downup # mysqladmin create downup # mysqlshow downup # mysqldump -v downup # mysqlaccess downup # INT = 4 Byte = FFFFFFFF = 4294967295 # MEDIUMINT = 3 Byte = FFFFFF = 16777215 # SMALLINT = 2 Byte = FFFF = 65535 # TINYINT = 1 Byte = FF = 255 # all _id fields are numbers in tables # names ARE case sensitive! # show tables; +------------+------------------+------------------+-----------------+--------------------+-------------------+-----------------------+ | contact_id | contact_fullname | contact_password | contact_company | contact_inceptdate | contact_lastvisit | contact_visit_counter | +------------+------------------+------------------+-----------------+--------------------+-------------------+-----------------------+ | 1 | infospace | infospace | InfoSpace | 2000-04-12 | 0000-00-00 | 0 | | 2 | leviathon | leviathon | leviathon | 2000-04-12 | 0000-00-00 | 0 | | 3 | microsoft | microsoft | Microsoft | 2000-04-12 | 0000-00-00 | 0 | | 4 | popcom | popcom | pop.com | 2000-04-12 | 0000-00-00 | 0 | | 5 | preference | preference | Preference | 2000-04-12 | 0000-00-00 | 0 | | 6 | radiointercast | radiointercast | Radio Intercast | 2000-04-12 | 0000-00-00 | 0 | +------------+------------------+------------------+-----------------+--------------------+-------------------+-----------------------+ 6 rows in set (0.01 sec) select * from Contact_Table; ###drop table Contact_Table; CREATE TABLE Contact_Table ( contact_id MEDIUMINT(10) DEFAULT '0' NOT NULL auto_increment PRIMARY KEY, contact_fullname VARCHAR(30) DEFAULT '0' NOT NULL, contact_password VARCHAR(20) DEFAULT '0' NOT NULL, contact_company VARCHAR(50) DEFAULT '0' NOT NULL, contact_inceptdate DATE DEFAULT '000000' NOT NULL, contact_lastvisit DATE DEFAULT '000000' NOT NULL, contact_visit_counter MEDIUMINT(5) DEFAULT '0' NOT NULL, contact_message TINYBLOB NOT NULL, INDEX (contact_password), INDEX (contact_fullname) ); insert into Contact_Table values (null,'infospace','infospace','InfoSpace',CURRENT_DATE(),'000000',0,'Welcome Infospace'); insert into Contact_Table values (null,'leviathon','leviathon','leviathon',CURRENT_DATE(),'000000',0,'Welcome leviathon'); insert into Contact_Table values (null,'microsoft','microsoft','Microsoft',CURRENT_DATE(),'000000',0,'Welcome Microsoft'); insert into Contact_Table values (null,'popcom','popcom','pop.com',CURRENT_DATE(),'000000',0,'Welcome pop.com'); insert into Contact_Table values (null,'preference','preference','Preference',CURRENT_DATE(),'000000',0,'Welcome Preference'); insert into Contact_Table values (null,'radiointercast','radiointercast','Radio Intercast',CURRENT_DATE(),'000000',0,'Welcome Radio Intercast'); ##insert into Contact_Table values (null,'$contact_fullname','$contact_password','$contact_company',null,0); update Contact_Table set contact_company = "WildTangent" where contact_company like '%angent%'; ##update contact_Table set contact_name = 'run' WHERE contact_name like 'run()'; ##delete from contact_Table where contact_id = 10; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// select * from Client_Table; select artist_name, cd_title from Client_Table, Artist_Table where Client_Table.cd_artist_id = Artist_Table.artist_id; select ucase(artist_name), ucase('hello') from Artist_Table; SELECT cd_upc,category_name,artist_name,cd_title,cd_price,label_name FROM Category_Table,Artist_Table,Client_Table,Label_Table WHERE Client_Table.cd_artist_id = Artist_Table.artist_id and Client_Table.cd_label_id = Label_Table.label_id and Client_Table.cd_category_id = Category_Table.category_id and Client_Table.cd_label_id = 7; delete from Category_Table where category_id = 9; insert into Client_Table values (0, 'cd_title',cd_artist_id,'cd_label',cd_label_id,'cd_upc', cd_status_id,cd_category_id,cd_price, null,cd_code,cd_desc,cd_image ); update Client_Table set cd_image = 'witherblisterburnpeel.jpg' where upc = '28'; update Client_Table set date = null where date = 000000; ALTER TABLE Client_Table CHANGE column cd_price cd_price FLOAT(6,2) NOT NULL; ALTER TABLE Client_Table ADD column cd_image VARCHAR(50); ALTER TABLE Client_Table ADD INDEX index_title (cd_title); SELECT upc,cd_title,artist_name,cd_price,cd_frizbcode,category_name,date,cd_status_id,status_id,status_name FROM Artist_Table,Client_Table,Category_Table,Label_Table,Status_Table WHERE artist_id = cd_artist_id AND category_id = cd_category_id AND cd_status_id = status_id AND label_id = cd_label_id ORDER BY date DESC,artist_name,cd_title LIMIT 1,10; select concat(substring(date,1,2),"/",substring(date,3,2),"/",substring(date,5,2)) from Client_Table; drop table Client_Table; LOAD DATA INFILE '/home/frizb/HTML/private/cris.tsv' REPLACE INTO TABLE Client_Table FIELDS OPTIONALLY ENCLOSED BY '"'; select * from Client_Table where artist_title like "front%"; ALTER TABLE Client_Table DROP column pin; ALTER TABLE Client_Table DROP column category; select * from Client_Table where artist_title like "front%";