SlideShare a Scribd company logo
[Type text] Page 1
MATERI MINGGU 1 – Prak. BASISDATA
PENGANTAR MY SQL
LABORATORIUM 4 – BASISDATA
Melihat dafar database di komputer :
RUMUS :
SHOW DATABASES;
HASIL :
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| webauth |
+--------------------+
Membuat database baru :
RUMUS :
CREATE DATABASE(spasi)NAMA_DATABASE;
CONTOH :
mysql> create database lab4;
Query OK, 1 row affected (0.09 sec)
Memakai database yang telah kita buat
RUMUS :
USE(spasi)NAMA_DATABASE;
CONTOH :
mysql> use lab4;
Database changed
Membuat tabel baru :
RUMUS :
CREATE TABLE NAMA_TABEL
(
Nama_Kolom1(spasi)tipe_data(ukuran),
Nama_Kolom2(spasi)tipe_data(ukuran),
[Type text] Page 2
Nama_Kolom3(spasi)tipe_data(ukuran),
Nama_Kolom4(spasi)tipe_data(ukuran));
CONTOH :
mysql> create table t_mhs(nim varchar(10), nama_mhs varchar(50),
alamat varchar(50), no_telp varchar(12));
Query OK, 0 rows affected (0.16 sec)
Melihat hasil tabel yang kita buat :
RUMUS :
DESC(spasi)NAMA_TABEL;
CONTOH :
mysql> desc t_mhs;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| nim | varchar(10) | YES | | NULL | |
| nama_mhs | varchar(50) | YES | | NULL | |
| alamat | varchar(50) | YES | | NULL | |
| no_telp | varchar(12) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
4 rows in set (0.08 sec)mysql> desc mahasiswa;
Input Data ke Dalam Tabel :
1. Menggunakan Rumus INSERT
2. Menggunakan Rumus LOAD DATA
1.Menginputkan data ke dalam tabel menggunakan perintah
INSERT
RUMUS :
Mysql >INSERT(spasi)INTO(spasi)NAMA_TABEL(spasi)VALUES
>(
>’DATA_KOLOM1’,
[Type text] Page 3
>’DATA_KOLOM2’,
>’DATA_KOLOM3’,
>’DATA_KOLOM4’
>);
CONTOH :
mysql> insert into t_mhs values( '111051005', 'Sholeh',
'Sleman','085785231478');
Query OK, 1 row affected (0.05 sec)
mysql> select *from t_mhs;
+-----------+----------+--------+--------------+
| nim | nama_mhs | alamat | no_telp |
+-----------+----------+--------+--------------+
| 111051005 | Sholeh | Sleman | 085785231478 |
+-----------+----------+--------+--------------+
5 rows in set (0.00 sec)
2.Menginputkan data ke dalam tabel menggunakan perintah
LOAD DATA
Persiapkan file yang berisi data yang akan diinputkan ke tabel
di database kita, sesuai dengan urutan yg kita buat di MYSQL.
Simpan dengan format .txt
CONTOH : (dibuat di MS.EXEL dan disimpan dengan nama data.txt
= format TEXT(MS-DOS) )
111051001 Uning Jogja 085786452315
111051002 Yuli Bantul 081354687923
111051003 Wanto Sleman 088869874563
111051004 Catur Bantul 081244455566
RUMUS :
LOAD(spasi)DATA(spasi)LOCAL(spasi)INFILE(spasi)
’LOKASI-FILE’(spasi)
INTO(spasi)
TABLE(spasi)
NAMA_TABEL
[Type text] Page 4
;
CONTOH :
mysql> load data local infile 'D://km1/data.txt' into table
t_mhs;
Query OK, 4 rows affected (0.03 sec)
Records: 4 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select*from t_mhs;
+-----------+----------+------------+---------------+
| nim | nama_mhs | alamat_mhs | no_telp |
+-----------+----------+------------+---------------+
|111051001 | Uning | Jogja | 085786452315
|111051002 | Yuli | Bantul | 081354687923
|111051003 | Wanto | Sleman | 088869874563
|111051004 | Catur | Bantul | 081244455566
+-----------+----------+------------+---------------+
4 rows in set (0.00 sec)
Menghapus database dan tabel
Buat dulu table baru
mysql> create table mat_kul(id_matkul varchar(10), nama_matkul
varchar(50), sks int(1), semester int(1), dosen varchar(10));
Query OK, 0 rows affected (0.02 sec)
mysql> desc mat_kul;
+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| id_matkul | varchar(10) | YES | | NULL | |
| nama_matkul | varchar(50) | YES | | NULL | |
| sks | int(1) | YES | | NULL | |
| semester | int(1) | YES | | NULL | |
| dosen | varchar(10) | YES | | NULL | |
+-------------+-------------+------+-----+---------+-------+
5 rows in set (0.03 sec)
Lihat tabel yang ada
[Type text] Page 5
mysql> show tables;
+----------------+
| Tables_in_lab4 |
+----------------+
| mat_kul |
| t_mhs |
+----------------+
2 rows in set (0.00 sec)
Hapus TABEL
DROP(spasi)TABLE(spasi)NAMA_TABEL
mysql> drop table mat_kul;
Query OK, 0 rows affected (0.02 sec)
mysql> show tables;
+----------------+
| Tables_in_lab4 |
+----------------+
| t_mhs |
+----------------+
1 row in set (0.00 sec)
Buat database baru
mysql> create database coba;
Query OK, 1 row affected (0.02 sec)
Lihat database yang ada
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| coba |
| lab4 |
| mysql |
| performance_schema |
| test |
[Type text] Page 6
+--------------------+
6 rows in set (0.00 sec)
HAPUS DATABASE
mysql> drop database coba;
Query OK, 0 rows affected (0.06 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| lab4 |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)
[Type text] Page 7
LATIHAN 1
Kerjakan soal – soal di bawah ini dengan teliti..!!
1. Buatlah Database baru bernama SN1_LATIHAN1
2. Buatlah Tabel baru bernama T_Buku dengan kolom sbb :
+-----------+-------------+
| Field | Type |
+-----------+-------------+
| id_buku | varchar(8) |
| nama_buku | varchar(50) |
| pengarang | varchar(50) |
| penerbit | varchar(50) |
| harga | int(6) |
+-----------+-------------+
3. Isilah tabel T_Buku dengan data sbb :
+---------+--------------------+--------------+----------+-------+
| id_buku | nama_buku | pengarang | penerbit | harga |
+---------+--------------------+--------------+----------+-------+
| AA-001 | Pemrograman Pascal | Alfred Riedl | Erlangga | 50000 |
| AA-002 | SQL Server 5.0 | Jono Ricardo | MyBook | 85000 |
| BB-001 | Obat Anti Galau | Tim Galauers | Gramedia | 40000 |
| BB-002 | Humor Indonesia | Hendi Susan | Andi Ho | 30000 |
+---------+--------------------+--------------+----------+-------+
4. Buat laporan Latihan ini di Ms.Word atau Notepad dengan nama file
SN2_NIM_Latihan1
5. Simpan di Folder masing – masing

More Related Content

What's hot

Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Tesora
 
MySQL's JSON Data Type and Document Store
MySQL's JSON Data Type and Document StoreMySQL's JSON Data Type and Document Store
MySQL's JSON Data Type and Document Store
Dave Stokes
 
Intro to OTP in Elixir
Intro to OTP in ElixirIntro to OTP in Elixir
Intro to OTP in Elixir
Jesse Anderson
 
MySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That BiteMySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That Bite
Ronald Bradford
 
The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 62 of 184
The Ring programming language version 1.5.3 book - Part 62 of 184The Ring programming language version 1.5.3 book - Part 62 of 184
The Ring programming language version 1.5.3 book - Part 62 of 184
Mahmoud Samir Fayed
 
اسلاید اول جلسه چهارم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه چهارم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه چهارم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه چهارم کلاس پایتون برای هکرهای قانونی
Mohammad Reza Kamalifard
 
Lecture2 mysql by okello erick
Lecture2 mysql by okello erickLecture2 mysql by okello erick
Lecture2 mysql by okello erick
okelloerick
 
MySQLinsanity
MySQLinsanityMySQLinsanity
MySQLinsanity
Stanley Huang
 
PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개
PgDay.Seoul
 
My SQL Idiosyncrasies That Bite OTN
My SQL Idiosyncrasies That Bite OTNMy SQL Idiosyncrasies That Bite OTN
My SQL Idiosyncrasies That Bite OTNRonald Bradford
 
Oracle ORA Errors
Oracle ORA ErrorsOracle ORA Errors
Oracle ORA Errors
Manish Mudhliyar
 
The ABCs of OTP
The ABCs of OTPThe ABCs of OTP
The ABCs of OTP
Jesse Anderson
 
groovy databases
groovy databasesgroovy databases
groovy databases
Paul King
 
Codigos
CodigosCodigos
Codigos
Brian Joseff
 
Database administration commands
Database administration commands Database administration commands
Database administration commands
Varsha Ajith
 
The Ring programming language version 1.7 book - Part 56 of 196
The Ring programming language version 1.7 book - Part 56 of 196The Ring programming language version 1.7 book - Part 56 of 196
The Ring programming language version 1.7 book - Part 56 of 196
Mahmoud Samir Fayed
 

What's hot (20)

Mysql basics1
Mysql basics1Mysql basics1
Mysql basics1
 
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
 
MySQL's JSON Data Type and Document Store
MySQL's JSON Data Type and Document StoreMySQL's JSON Data Type and Document Store
MySQL's JSON Data Type and Document Store
 
Intro to OTP in Elixir
Intro to OTP in ElixirIntro to OTP in Elixir
Intro to OTP in Elixir
 
MySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That BiteMySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That Bite
 
The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202
 
The Ring programming language version 1.5.3 book - Part 62 of 184
The Ring programming language version 1.5.3 book - Part 62 of 184The Ring programming language version 1.5.3 book - Part 62 of 184
The Ring programming language version 1.5.3 book - Part 62 of 184
 
اسلاید اول جلسه چهارم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه چهارم کلاس پایتون برای هکرهای قانونیاسلاید اول جلسه چهارم کلاس پایتون برای هکرهای قانونی
اسلاید اول جلسه چهارم کلاس پایتون برای هکرهای قانونی
 
Lecture2 mysql by okello erick
Lecture2 mysql by okello erickLecture2 mysql by okello erick
Lecture2 mysql by okello erick
 
MySQLinsanity
MySQLinsanityMySQLinsanity
MySQLinsanity
 
PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개
 
My SQL Idiosyncrasies That Bite OTN
My SQL Idiosyncrasies That Bite OTNMy SQL Idiosyncrasies That Bite OTN
My SQL Idiosyncrasies That Bite OTN
 
Oracle ORA Errors
Oracle ORA ErrorsOracle ORA Errors
Oracle ORA Errors
 
Intro to my sql
Intro to my sqlIntro to my sql
Intro to my sql
 
The ABCs of OTP
The ABCs of OTPThe ABCs of OTP
The ABCs of OTP
 
groovy databases
groovy databasesgroovy databases
groovy databases
 
Codigos
CodigosCodigos
Codigos
 
Database administration commands
Database administration commands Database administration commands
Database administration commands
 
Intro to my sql
Intro to my sqlIntro to my sql
Intro to my sql
 
The Ring programming language version 1.7 book - Part 56 of 196
The Ring programming language version 1.7 book - Part 56 of 196The Ring programming language version 1.7 book - Part 56 of 196
The Ring programming language version 1.7 book - Part 56 of 196
 

Viewers also liked

SBTUG 28 July 2010 SQL Server 2008 R2
SBTUG 28 July 2010 SQL Server 2008 R2SBTUG 28 July 2010 SQL Server 2008 R2
SBTUG 28 July 2010 SQL Server 2008 R2
Craig Bailey
 
Sql 2008 and project server 2010
Sql 2008 and project server 2010Sql 2008 and project server 2010
Sql 2008 and project server 2010
Eduardo Castro
 
Modul Kelas Programming : Introduction to java
Modul Kelas Programming : Introduction to javaModul Kelas Programming : Introduction to java
Modul Kelas Programming : Introduction to java
FgroupIndonesia
 
My sql dari Pemula hingga Mahir (achmad solichin)
My sql dari Pemula hingga Mahir (achmad solichin)My sql dari Pemula hingga Mahir (achmad solichin)
My sql dari Pemula hingga Mahir (achmad solichin)
FaRid Adwa
 
Visual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetVisual Basic.Net & Ado.Net
Visual Basic.Net & Ado.Net
FaRid Adwa
 
Modul Kelas Programming : Java swing 1
Modul Kelas Programming : Java swing 1Modul Kelas Programming : Java swing 1
Modul Kelas Programming : Java swing 1
FgroupIndonesia
 
Modul Kelas Programming : Java swing (session 2)
Modul Kelas Programming : Java swing (session 2)Modul Kelas Programming : Java swing (session 2)
Modul Kelas Programming : Java swing (session 2)
FgroupIndonesia
 
Database Operation di VB.NET
Database Operation di VB.NETDatabase Operation di VB.NET
Database Operation di VB.NET
FgroupIndonesia
 

Viewers also liked (8)

SBTUG 28 July 2010 SQL Server 2008 R2
SBTUG 28 July 2010 SQL Server 2008 R2SBTUG 28 July 2010 SQL Server 2008 R2
SBTUG 28 July 2010 SQL Server 2008 R2
 
Sql 2008 and project server 2010
Sql 2008 and project server 2010Sql 2008 and project server 2010
Sql 2008 and project server 2010
 
Modul Kelas Programming : Introduction to java
Modul Kelas Programming : Introduction to javaModul Kelas Programming : Introduction to java
Modul Kelas Programming : Introduction to java
 
My sql dari Pemula hingga Mahir (achmad solichin)
My sql dari Pemula hingga Mahir (achmad solichin)My sql dari Pemula hingga Mahir (achmad solichin)
My sql dari Pemula hingga Mahir (achmad solichin)
 
Visual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetVisual Basic.Net & Ado.Net
Visual Basic.Net & Ado.Net
 
Modul Kelas Programming : Java swing 1
Modul Kelas Programming : Java swing 1Modul Kelas Programming : Java swing 1
Modul Kelas Programming : Java swing 1
 
Modul Kelas Programming : Java swing (session 2)
Modul Kelas Programming : Java swing (session 2)Modul Kelas Programming : Java swing (session 2)
Modul Kelas Programming : Java swing (session 2)
 
Database Operation di VB.NET
Database Operation di VB.NETDatabase Operation di VB.NET
Database Operation di VB.NET
 

Similar to Materi my sql part 1

Introduction databases and MYSQL
Introduction databases and MYSQLIntroduction databases and MYSQL
Introduction databases and MYSQL
Naeem Junejo
 
PHP mysql Introduction database
 PHP mysql  Introduction database PHP mysql  Introduction database
PHP mysql Introduction database
Mudasir Syed
 
介绍 MySQL
介绍 MySQL介绍 MySQL
介绍 MySQL
YUCHENG HU
 
mysql-Tutorial with Query presentation.ppt
mysql-Tutorial with Query presentation.pptmysql-Tutorial with Query presentation.ppt
mysql-Tutorial with Query presentation.ppt
aptechaligarh
 
database-querry-student-note
database-querry-student-notedatabase-querry-student-note
database-querry-student-noteLeerpiny Makouach
 
MySql:Introduction
MySql:IntroductionMySql:Introduction
MySql:Introduction
DataminingTools Inc
 
MySQL Introduction
MySQL IntroductionMySQL Introduction
MySQL Introduction
mysql content
 
15 MySQL Basics #burningkeyboards
15 MySQL Basics #burningkeyboards15 MySQL Basics #burningkeyboards
15 MySQL Basics #burningkeyboards
Denis Ristic
 
MySQL Basics
MySQL BasicsMySQL Basics
MySQL Basics
mysql content
 
MySql:Basics
MySql:BasicsMySql:Basics
MySql:Basics
DataminingTools Inc
 
Instalar MySQL CentOS
Instalar MySQL CentOSInstalar MySQL CentOS
Instalar MySQL CentOS
Moisés Elías Araya
 
Introduction To Lamp P2
Introduction To Lamp P2Introduction To Lamp P2
Introduction To Lamp P2
Amzad Hossain
 
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
teachersduniya.com
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinhwebhostingguy
 
Advance MySQL Training by Pratyush Majumdar
Advance MySQL Training by Pratyush MajumdarAdvance MySQL Training by Pratyush Majumdar
Advance MySQL Training by Pratyush Majumdar
Pratyush Majumdar
 

Similar to Materi my sql part 1 (20)

My sql1
My sql1My sql1
My sql1
 
Intro to my sql
Intro to my sqlIntro to my sql
Intro to my sql
 
Introduction databases and MYSQL
Introduction databases and MYSQLIntroduction databases and MYSQL
Introduction databases and MYSQL
 
PHP mysql Introduction database
 PHP mysql  Introduction database PHP mysql  Introduction database
PHP mysql Introduction database
 
介绍 MySQL
介绍 MySQL介绍 MySQL
介绍 MySQL
 
mysql-Tutorial with Query presentation.ppt
mysql-Tutorial with Query presentation.pptmysql-Tutorial with Query presentation.ppt
mysql-Tutorial with Query presentation.ppt
 
My SQL
My SQLMy SQL
My SQL
 
database-querry-student-note
database-querry-student-notedatabase-querry-student-note
database-querry-student-note
 
MySql:Introduction
MySql:IntroductionMySql:Introduction
MySql:Introduction
 
MySQL Introduction
MySQL IntroductionMySQL Introduction
MySQL Introduction
 
15 MySQL Basics #burningkeyboards
15 MySQL Basics #burningkeyboards15 MySQL Basics #burningkeyboards
15 MySQL Basics #burningkeyboards
 
MySQL Basics
MySQL BasicsMySQL Basics
MySQL Basics
 
MySql:Basics
MySql:BasicsMySql:Basics
MySql:Basics
 
Instalar MySQL CentOS
Instalar MySQL CentOSInstalar MySQL CentOS
Instalar MySQL CentOS
 
Introduction To Lamp P2
Introduction To Lamp P2Introduction To Lamp P2
Introduction To Lamp P2
 
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
 
mysqlHiep.ppt
mysqlHiep.pptmysqlHiep.ppt
mysqlHiep.ppt
 
Advance MySQL Training by Pratyush Majumdar
Advance MySQL Training by Pratyush MajumdarAdvance MySQL Training by Pratyush Majumdar
Advance MySQL Training by Pratyush Majumdar
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 

Recently uploaded

2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 

Recently uploaded (20)

2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 

Materi my sql part 1

  • 1. [Type text] Page 1 MATERI MINGGU 1 – Prak. BASISDATA PENGANTAR MY SQL LABORATORIUM 4 – BASISDATA Melihat dafar database di komputer : RUMUS : SHOW DATABASES; HASIL : +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | webauth | +--------------------+ Membuat database baru : RUMUS : CREATE DATABASE(spasi)NAMA_DATABASE; CONTOH : mysql> create database lab4; Query OK, 1 row affected (0.09 sec) Memakai database yang telah kita buat RUMUS : USE(spasi)NAMA_DATABASE; CONTOH : mysql> use lab4; Database changed Membuat tabel baru : RUMUS : CREATE TABLE NAMA_TABEL ( Nama_Kolom1(spasi)tipe_data(ukuran), Nama_Kolom2(spasi)tipe_data(ukuran),
  • 2. [Type text] Page 2 Nama_Kolom3(spasi)tipe_data(ukuran), Nama_Kolom4(spasi)tipe_data(ukuran)); CONTOH : mysql> create table t_mhs(nim varchar(10), nama_mhs varchar(50), alamat varchar(50), no_telp varchar(12)); Query OK, 0 rows affected (0.16 sec) Melihat hasil tabel yang kita buat : RUMUS : DESC(spasi)NAMA_TABEL; CONTOH : mysql> desc t_mhs; +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | nim | varchar(10) | YES | | NULL | | | nama_mhs | varchar(50) | YES | | NULL | | | alamat | varchar(50) | YES | | NULL | | | no_telp | varchar(12) | YES | | NULL | | +----------+-------------+------+-----+---------+-------+ 4 rows in set (0.08 sec)mysql> desc mahasiswa; Input Data ke Dalam Tabel : 1. Menggunakan Rumus INSERT 2. Menggunakan Rumus LOAD DATA 1.Menginputkan data ke dalam tabel menggunakan perintah INSERT RUMUS : Mysql >INSERT(spasi)INTO(spasi)NAMA_TABEL(spasi)VALUES >( >’DATA_KOLOM1’,
  • 3. [Type text] Page 3 >’DATA_KOLOM2’, >’DATA_KOLOM3’, >’DATA_KOLOM4’ >); CONTOH : mysql> insert into t_mhs values( '111051005', 'Sholeh', 'Sleman','085785231478'); Query OK, 1 row affected (0.05 sec) mysql> select *from t_mhs; +-----------+----------+--------+--------------+ | nim | nama_mhs | alamat | no_telp | +-----------+----------+--------+--------------+ | 111051005 | Sholeh | Sleman | 085785231478 | +-----------+----------+--------+--------------+ 5 rows in set (0.00 sec) 2.Menginputkan data ke dalam tabel menggunakan perintah LOAD DATA Persiapkan file yang berisi data yang akan diinputkan ke tabel di database kita, sesuai dengan urutan yg kita buat di MYSQL. Simpan dengan format .txt CONTOH : (dibuat di MS.EXEL dan disimpan dengan nama data.txt = format TEXT(MS-DOS) ) 111051001 Uning Jogja 085786452315 111051002 Yuli Bantul 081354687923 111051003 Wanto Sleman 088869874563 111051004 Catur Bantul 081244455566 RUMUS : LOAD(spasi)DATA(spasi)LOCAL(spasi)INFILE(spasi) ’LOKASI-FILE’(spasi) INTO(spasi) TABLE(spasi) NAMA_TABEL
  • 4. [Type text] Page 4 ; CONTOH : mysql> load data local infile 'D://km1/data.txt' into table t_mhs; Query OK, 4 rows affected (0.03 sec) Records: 4 Deleted: 0 Skipped: 0 Warnings: 0 mysql> select*from t_mhs; +-----------+----------+------------+---------------+ | nim | nama_mhs | alamat_mhs | no_telp | +-----------+----------+------------+---------------+ |111051001 | Uning | Jogja | 085786452315 |111051002 | Yuli | Bantul | 081354687923 |111051003 | Wanto | Sleman | 088869874563 |111051004 | Catur | Bantul | 081244455566 +-----------+----------+------------+---------------+ 4 rows in set (0.00 sec) Menghapus database dan tabel Buat dulu table baru mysql> create table mat_kul(id_matkul varchar(10), nama_matkul varchar(50), sks int(1), semester int(1), dosen varchar(10)); Query OK, 0 rows affected (0.02 sec) mysql> desc mat_kul; +-------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ | id_matkul | varchar(10) | YES | | NULL | | | nama_matkul | varchar(50) | YES | | NULL | | | sks | int(1) | YES | | NULL | | | semester | int(1) | YES | | NULL | | | dosen | varchar(10) | YES | | NULL | | +-------------+-------------+------+-----+---------+-------+ 5 rows in set (0.03 sec) Lihat tabel yang ada
  • 5. [Type text] Page 5 mysql> show tables; +----------------+ | Tables_in_lab4 | +----------------+ | mat_kul | | t_mhs | +----------------+ 2 rows in set (0.00 sec) Hapus TABEL DROP(spasi)TABLE(spasi)NAMA_TABEL mysql> drop table mat_kul; Query OK, 0 rows affected (0.02 sec) mysql> show tables; +----------------+ | Tables_in_lab4 | +----------------+ | t_mhs | +----------------+ 1 row in set (0.00 sec) Buat database baru mysql> create database coba; Query OK, 1 row affected (0.02 sec) Lihat database yang ada mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | coba | | lab4 | | mysql | | performance_schema | | test |
  • 6. [Type text] Page 6 +--------------------+ 6 rows in set (0.00 sec) HAPUS DATABASE mysql> drop database coba; Query OK, 0 rows affected (0.06 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | lab4 | | mysql | | performance_schema | | test | +--------------------+ 5 rows in set (0.00 sec)
  • 7. [Type text] Page 7 LATIHAN 1 Kerjakan soal – soal di bawah ini dengan teliti..!! 1. Buatlah Database baru bernama SN1_LATIHAN1 2. Buatlah Tabel baru bernama T_Buku dengan kolom sbb : +-----------+-------------+ | Field | Type | +-----------+-------------+ | id_buku | varchar(8) | | nama_buku | varchar(50) | | pengarang | varchar(50) | | penerbit | varchar(50) | | harga | int(6) | +-----------+-------------+ 3. Isilah tabel T_Buku dengan data sbb : +---------+--------------------+--------------+----------+-------+ | id_buku | nama_buku | pengarang | penerbit | harga | +---------+--------------------+--------------+----------+-------+ | AA-001 | Pemrograman Pascal | Alfred Riedl | Erlangga | 50000 | | AA-002 | SQL Server 5.0 | Jono Ricardo | MyBook | 85000 | | BB-001 | Obat Anti Galau | Tim Galauers | Gramedia | 40000 | | BB-002 | Humor Indonesia | Hendi Susan | Andi Ho | 30000 | +---------+--------------------+--------------+----------+-------+ 4. Buat laporan Latihan ini di Ms.Word atau Notepad dengan nama file SN2_NIM_Latihan1 5. Simpan di Folder masing – masing