0% found this document useful (0 votes)
51 views4 pages

SQL Dump for Akademik Database

This document contains the SQL code to create an Entity Relationship Diagram (ERD) for a university database with tables for students, courses, professors and student course registrations. The ERD includes 5 tables with attributes and primary keys defined for each. Foreign key constraints are also specified to link the tables together.
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)
51 views4 pages

SQL Dump for Akademik Database

This document contains the SQL code to create an Entity Relationship Diagram (ERD) for a university database with tables for students, courses, professors and student course registrations. The ERD includes 5 tables with attributes and primary keys defined for each. Foreign key constraints are also specified to link the tables together.
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

1.

ERD
3. Perintah SQL

-- phpMyAdmin SQL Dump


-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 27, 2023 at 06:24 AM
-- Server version: 10.4.28-MariaDB
-- PHP Version: 8.2.4

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";


START TRANSACTION;
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;


/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `akademik`
--

-- --------------------------------------------------------

--
-- Table structure for table `dosen`
--

CREATE TABLE `dosen` (


`nidn` int(11) NOT NULL,
`nama` varchar(25) NOT NULL,
`hp` bigint(15) NOT NULL,
`keahlian` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `krs`
--
CREATE TABLE `krs` (
`nim` int(11) NOT NULL,
`nidn` int(15) NOT NULL,
`id_matkul` int(25) NOT NULL,
`ruangan` varchar(15) NOT NULL,
`jam_masuk` date NOT NULL,
`jam_keluar` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `mahasiswa`
--

CREATE TABLE `mahasiswa` (


`nim` int(11) NOT NULL,
`nama` varchar(25) NOT NULL,
`alamat` varchar(50) NOT NULL,
`hp` bigint(15) NOT NULL,
`tahun_masuk` date NOT NULL,
`reguler` enum('a','b','c','d') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `matakuliah`
--

CREATE TABLE `matakuliah` (


`id_matakulaih` int(11) NOT NULL,
`nama_matakulaih` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `dosen`
--
ALTER TABLE `dosen`
ADD PRIMARY KEY (`nidn`);
--
-- Indexes for table `krs`
--
ALTER TABLE `krs`
ADD PRIMARY KEY (`nim`),
ADD KEY `nidn` (`nidn`),
ADD KEY `id_matkul` (`id_matkul`);

--
-- Indexes for table `mahasiswa`
--
ALTER TABLE `mahasiswa`
ADD PRIMARY KEY (`nim`);

--
-- Indexes for table `matakuliah`
--
ALTER TABLE `matakuliah`
ADD PRIMARY KEY (`id_matakulaih`);

--
-- Constraints for dumped tables
--

--
-- Constraints for table `krs`
--
ALTER TABLE `krs`
ADD CONSTRAINT `krs_ibfk_1` FOREIGN KEY (`nim`) REFERENCES `mahasiswa` (`nim`)
ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `krs_ibfk_2` FOREIGN KEY (`id_matkul`) REFERENCES `matakuliah`
(`id_matakulaih`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `krs_ibfk_3` FOREIGN KEY (`nidn`) REFERENCES `dosen` (`nidn`) ON
DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;


/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

You might also like