49 lines
965 B
Text
49 lines
965 B
Text
MySQL -u root -p
|
|
|
|
show databases;
|
|
|
|
use namadatabase;
|
|
|
|
describe tabelyangdimau;
|
|
|
|
create database namadatabase;
|
|
|
|
create table namatabel (
|
|
namarownya int auto_increment primary key,
|
|
namarow varchar(20) not null
|
|
);
|
|
|
|
insert into namatabel (namarownya, namarow, tahun)
|
|
values
|
|
('164231049', 'budianto', 2023),
|
|
('164231040', 'budianti', 2023);
|
|
|
|
|
|
select * from namatabel; (* semua artinya)
|
|
|
|
select * from namatbel where tahun = 2023
|
|
|
|
select nama, nim from mahasiswa;
|
|
|
|
select nama, nim from mahasiswa where angkatan = 2023;
|
|
|
|
create or replace database namadatabase;
|
|
|
|
create table guru_pengajar (
|
|
-> nig int,
|
|
-> namaguru varchar(20) not null,
|
|
->
|
|
-> foreign key (nig) references guru (nig);
|
|
|
|
CREATE TABLE dept (
|
|
deptno SMALLINT NOT NULL AUTO_INCREMENT,
|
|
deptname VARCHAR(36) NOT NULL,
|
|
mgrno CHAR(6),
|
|
location CHAR(30),
|
|
PRIMARY KEY (deptno) -- Tambahkan baris ini
|
|
) AUTO_INCREMENT = 500;
|
|
|
|
|
|
|
|
|