- membuat database <CREATE DATABASE ..... >
- membuat tabel <CREATE TABLE ..... >
- mengisi tabel <INSERT INTO ...... VALUES ..... >
- menambah field <ALTER TABLE ...... ADD ..... >
- mengisi tabel pada field baru <UPDATE ..... SET ..... WHERE ..... >
- menghapus field <ALTER TABLE ..... DROP COLUMN ..... >
- menghapus isi tabel <DELETE FROM ..... WHERE ..... >
- mengganti nama tabel <ALTER TABEL ..... TO ..... >
- membuat database :
use <nama database>;
- membuat tabel
select*from <nama tabel>
- Mengisi tabel
select*from <nama tabel>;
- Menambah Field
select*from <nama tabel>;
- Mengisi tabel pada field baru
select*from <nama tabel>;
- Menghapus Field
select*from <nama tabel>
- Menghapus isi tabel
select*from dataguru
- Mengganti nama table
CONTOH :
create database guru;
use guru;
create table dataguru (NIP varchar(10), Nama varchar(30), Alamat varchar(30));
select*from dataguru
insert into dataguru values ('001','Farih Daroini','Besito Kauman')
select*from dataguru
insert into dataguru values ('002','Sabila Al Haqqi','Besito Kauman');
select*from dataguru
alter table dataguru add Telepon varchar(15)
select*from dataguru
update dataguru set Telepon='08971984718' where NIP= '001'
select*from dataguru
update dataguru set Telepon='089694436906' where NIP= '002'
select*from dataguru
alter table dataguru drop column Telepon
select*from dataguru
delete from dataguru where NIP='002';
select*from dataguru
ALTER TABLE dataguru to data_guru;
No comments:
Post a Comment