Rabu, 16 Januari 2013

TUGAS 4 Kelompok SMBD


TUGAS 4 KELOMPOK
SISTEM MANAJEMEN BASIS DATA



   NAMA KELOMPOK :

                                     Nur Arifah Juliyanti     : 101051047
                                     Anggreawan                 : 101051059
                                     Bambang Wahyu S       : 101051081
                                     Andrianto                      : 101051005
                            

JURUSAN TEKNIK INFORMATIKA
FAKULTAS TEKNOLOGI INDUSTRI
INSTITUT SAINS DAN TEKNOLOGI AKPRIND YOGYAKARTA
2013





Mysql : select version(), current_date;


Mysql> select sin(pi()/4>,(4+1)*5;
Mysql> select version(); select now();



Mysql> select user(), current_date;
Mysql> select user() \c


Mysql> select * from my_table where nane * smith and age <38;
Ø  ‘\c
Mysql> \h



Mysql> select  1+1;
Mysql> select  1+1 #THIS COMMENT CONTINUES TO THE END OP LINE
Mysql> select  1+1 –THIS COMMENT CONTINUES TO THE END OP LINE


Mysql> select 1 /*this is an in=line comment */  + 1;
Mysq;> select  1+ /* this is a multiple-line comment */ 1;


Mysql> select  1+2*3;
Mysql> select  (1+2)*3;
Mysql> shoq databases;
Mysql> create database pethouse;
Mysql> show databases;



Mysql> use pethouse
Database changed
Mysql> drop database pethouse;


Mysql> show tables;
Mysql> create table pet(nane varchar(20), owner varchar(20), species varchar(20), sex char(1), birth date, date date);
Mysql>  show tables;
Mysql> describe pet;
Mysql> insert into pet values(‘pluffy’,’harold’,’cat’,’f’,’1993-02-04’,’null’);



Mysql> load local infile ‘G://daftar.txt’into table pet;
Mysql>  select * from pet;
Mysql> load local infile ‘G://daftar2.txt’into table pet;
Mysql> select * from pet;



Mysql> use pethouse;
Database changed
Mysql> show tables;
Mysql> drop table pet;


Mysql> CREATE TABLE TABLE(id INT AUTO_INCREMENT primary key, nane varchar(30) not null, salary float(10.2) default 1000000);
Mysql> DESCRIBE TABLE1;



Mysql> CREATE TABLE TABLE2(id INT AUTO_INCREMENT PRIMARY KEY, nane varchar(30));
Mysql> DESCRIBE TABLE2;


Mysql> CREATE TABLE cars(id INT PRIMARY KEY AUTO_INCREMENT, plate varchar (10), brand varchar(10), unique(plate);
Mysql> DESC cars;
Mysql> INSERT INTO cars VALUES(1,’AB-1234-CD’,’toyota’);
Mysql> select * from cars;



Mysql> SHOW TABLES;



Mysql> CREATE TABLE IF NOT EXISTS TABLE2(id INT AUTO_INCREMENT primary key, nane varchar(30) not null, salary float(10.2) default 1000000);



Mysql> CREATE TABLE IF NOT EXISTS TABLE4(id INT AUTO_INCREMENT primary key,nane varchar(30) not null, salary float(10.2) default 1000000);
Mysql> SHOW TABLES;



CREATE TABLE employee2 (id INT AUTO_INCREMENT PRIMARY KEY,name VARCHAR(15),city VARCHAR(20));
DESC employee2;


Show databases;
-9


Select*from employee_copy;


Create temporary table temptbl(id int primary key auto_increment, nama varchar(30));



Show databases;


Desc models;


Create table orders;
Desc orders;
Insert into models valves (1,’testsatu’);
Select*from models;






Insert into orders valus (1, 1, ‘deskripsisatu’);
Select*from orders;






Delete from models where modelid =1;
Select*from models;
Select*from orders;






Create table table5(id int);
Desc table5;
Alter table table5 add name varchar(5);
Dee table5;






Alter table table5 add first_name varchar(30) after id;
Desc table5;
Alter table table5 change name last_name varchar(30);
Desc table5;
Alter table table5 modify first_name varchar(15), modify last_name varchar(15);
Desc table5;
Alter table table5 add primary key(id);
Desc table5;






Alter table table5 drop first_name;
Desc table5;
Show tables;
Alter table employee_copy rename senior_employee;
Show tables;



Create table employee_copy as select*from employee;
Select*from employee_copy;
Truncate table employee_copy;
Select*from employee_copy;



Select*from employee_copy;
Truncate table employee_copy;
Select*from employee_copy;
Drop table employee_copy;
Show table5;
Desc employee;



INSERT INTO employee VALUES
('9','James','Bond','1982-04-21','2002-09-23','1234.56','London','Spy'),
('10','Hercule','Poirot','1973-05-23','2001-08-09','4312.98','Brussels','Detective'),
('11','Lincoln','Rhyme','1999-05-25','2011-07-13','3212.98','New York','Forensics'),
('12','Sherlock','Holmes','1923-08-12','1945-07-21','4123.21','London','Detective');
Select*from employee;



SELECT * FROM employee;

CREATE TABLE employee2 (id INT AUTO_INCREMENT PRIMARY KEY,name VARCHAR(15),city VARCHAR(20));

DESC employee2;

INSERT INTO employee2 (id, name, city) SELECT id, CONCAT(first_name,' ',last_name), city FROM employee;

SELECT * FROM employee2;

UPDATE employee2 SET city = 'Ottawa'WHERE city = 'Vancouver';

SELECT * FROM employee2;

SELECT salary FROM employee;

UPDATE employee SET salary = salary + 1;

SELECT salary FROM employee;

SELECT * FROM employee2;




SELECT salary FROM employee;

UPDATE employee SET salary = salary + 1;

SELECT salary FROM employee;

SELECT * FROM employee2;



Select*from employee2;



SELECT * FROM employee2;

SELECT * FROM employee2;

DELETE FROM employee2 WHERE city = 'New York';

SELECT * FROM employee2;







Tidak ada komentar:

Posting Komentar