Wednesday, January 26, 2011

mysql-starter

#how to import a data base
yonten@loves-bear:~/Desktop/Exercise Files/Exercise Files/Exercise Files/SQL$ mysql -u root -p < world-mysql.sql
#CREATE A NEW DATABASE
CREATE DATA BASE tashi;

#to display

# to create a database\
create database yonten ;
----------------------------------------------------------------------------
#to create a table within a database yonten
use yonten;
CREATE TABLE yonten_class ( id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(225). Address VARCHAR(225), City VARCHAR(225), State CHAR(2),Country VARCHAR(10));
----------------------------------------------------------------------------

#to align the data to left or right
select lpad(title, 30, ' ') from album ;
or
selct rpad(title, 30, ' ') from album ;

-----------------------------------------------------------------------------