0% found this document useful (0 votes)
5 views

Latihan 5

Uploaded by

Gunawan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Latihan 5

Uploaded by

Gunawan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Microsoft Windows [Version 10.0.19045.

5011]

(c) Microsoft Corporation. All rights reserved.

C:\Users\user>cd c:/

c:\>cd xaampp/mysql/bin

The system cannot find the path specified.

c:\>cd xampp

c:\xampp>cd bin

The system cannot find the path specified.

c:\xampp>cd mysql

c:\xampp\mysql>cd bin

c:\xampp\mysql\bin>mysql -u root -p

Enter password:

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 8

Server version: 10.4.32-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create databases latihan_5;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MariaDB server version for the right syntax to use near 'databases latihan_5' at line 1

MariaDB [(none)]> create database latihan_5;

Query OK, 1 row affected (0.002 sec)

MariaDB [(none)]> use database latihan_5

ERROR 1049 (42000): Unknown database 'database'

MariaDB [(none)]> use latihan_5

Database changed

MariaDB [latihan_5]> create table penerbit (

-> kd_penerbit int primary key auto_increment,

-> nama_penerbit varchar(100) not null);

Query OK, 0 rows affected (0.018 sec)

MariaDB [latihan_5]> create table buku(

-> kd_buku int primary key auto_increment,

-> judul_buku varchar(100) not null,

-> jumlah int not null,

-> kode_penerbit int foreign key(kd_penerbit) references penerbit(kd_penerbit) not null);

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MariaDB server version for the right syntax to use near 'foreign key(kd_penerbit) references
penerbit(kd_penerbit) not null)' at line 5

MariaDB [latihan_5]> create table buku(

-> kd_buku int primary key auto_increment,

-> judul_buku varchar(100) not null,

-> jumlah int not null,

-> kode_penerbit int foreign key(kd_penerbit) references penerbit(kd_penerbit));

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MariaDB server version for the right syntax to use near 'foreign key(kd_penerbit) references
penerbit(kd_penerbit))' at line 5
MariaDB [latihan_5]> describe penerbit;

+---------------+--------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+---------------+--------------+------+-----+---------+----------------+

| kd_penerbit | int(11) | NO | PRI | NULL | auto_increment |

| nama_penerbit | varchar(100) | NO | | NULL | |

+---------------+--------------+------+-----+---------+----------------+

2 rows in set (0.033 sec)

MariaDB [latihan_5]> create table buku(

-> kd_buku int primary key auto_increment,

-> judul_buku varchar(100) not null,

-> jumlah int not null,

-> kd_penerbit int foreign key(kd_penerbit) references penerbit(kd_penerbit) not null);

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MariaDB server version for the right syntax to use near 'foreign key(kd_penerbit) references
penerbit(kd_penerbit) not null)' at line 5

MariaDB [latihan_5]> create table buku(

-> kd_buku int primary key auto_increment,

-> judul_buku varchar(100) not null,

-> jumlah int not null,

-> kd_penerbit int not null, foreign key(kd_penerbit) references penerbit(kd_penerbit));

Query OK, 0 rows affected (0.068 sec)

MariaDB [latihan_5]> describe penerbit

-> ;

+---------------+--------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+---------------+--------------+------+-----+---------+----------------+
| kd_penerbit | int(11) | NO | PRI | NULL | auto_increment |

| nama_penerbit | varchar(100) | NO | | NULL | |

+---------------+--------------+------+-----+---------+----------------+

2 rows in set (0.035 sec)

MariaDB [latihan_5]> describe buku;

+-------------+--------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+-------------+--------------+------+-----+---------+----------------+

| kd_buku | int(11) | NO | PRI | NULL | auto_increment |

| judul_buku | varchar(100) | NO | | NULL | |

| jumlah | int(11) | NO | | NULL | |

| kd_penerbit | int(11) | NO | MUL | NULL | |

+-------------+--------------+------+-----+---------+----------------+

4 rows in set (0.037 sec)

MariaDB [latihan_5]> selecet

You might also like