Nama
Database : Penjualan
Sintak
:
Create
Database 'penjualan';
Nama
Tabel : barang
Sintak
:
CREATE TABLE `penjualan`.`barang` (
`kode_barang` VARCHAR( 4 ) NOT NULL ,
`nama_barang` VARCHAR( 25 ) NOT NULL ,
`satuan` VARCHAR( 20 ) NOT NULL ,
`harga` INT NOT NULL ,
PRIMARY KEY ( `kode_barang` )
`nama_barang` VARCHAR( 25 ) NOT NULL ,
`satuan` VARCHAR( 20 ) NOT NULL ,
`harga` INT NOT NULL ,
PRIMARY KEY ( `kode_barang` )
) ENGINE = MYISAM ;
========================================================
Menyisipkan Isi
Sintak
:
INSERT INTO `penjualan`.`barang`
(`kode_barang`, `nama_barang`, ‘satuan`, `harga`) VALUES ('A001',
'Saus ABC 100ml', 'Botol', '6000'), ('A002', 'Attack 2kg', 'Bungkus', '20000'),
('A003', 'Pulpen Faster', 'Benda', '2000'), ('A004', 'Clink ',
'Botol', '12000');
========================================================
Nama
Database : Transaksi
Sintak
:
Create
Database 'transaksi';
Nama
Tabel: costumer
Sintak
:
CREATE TABLE `TRANSAKSI`.`COSTUMER` (`KODE_TRANSAKSI`
VARCHAR(10) NOT NULL, `ID_COSTUMER`VARCHAR(10) NOT NULL, `KODE_BARANG` VARCHAR(5) NOT NULL, `NAMA_BARANG` VARCHAR(20) NOT NULL, `TGL_TRANSAKSI` DATE NOT NULL, PRIMARY KEY (`ID_COSTUMER`)) ENGINE = MYISAM;
VARCHAR(10) NOT NULL, `ID_COSTUMER`VARCHAR(10) NOT NULL, `KODE_BARANG` VARCHAR(5) NOT NULL, `NAMA_BARANG` VARCHAR(20) NOT NULL, `TGL_TRANSAKSI` DATE NOT NULL, PRIMARY KEY (`ID_COSTUMER`)) ENGINE = MYISAM;
========================================================
Menyisipkan
Isi
- Pada database mahasiswa dan tabel penilaian
Sintak :
INSERT INTO `trt`.`penilaian` (`nim`, `KdMK`, `NamaMK`, `Mid`,
`Final`, `NilRata`)VALUES
('10296832', 'KK021', 'Sistem Basis Data', '75', '82',
'78.5'),
('10297732', 'KD132', 'SIM', '77.5', '73.5', '75.5'),
('20216832',
'KK021', 'Sistem Basis Data', '83.5', '81.7',
'82.'),
('30216832', 'KU122', 'Pancasila', '65.4', '77',
'71.2'),
('11297732', 'KK021', 'Sistem Basis Data', '79.5',
'82.5', '81'),
('21216832', 'KD132', 'SIM', '80', '83', '81.75'),
('31216832', 'KK021', 'Sistem Basis Data', '67', '78',
'72.5')