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

SQL - Sturctured Query Language

Uploaded by

Karim Handoyo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

SQL - Sturctured Query Language

Uploaded by

Karim Handoyo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

SQL_Sturctured Query Language

SEQUEL
SQL developed in the 1970 by IBM researchers Raymond Boyce and Donald Chamberlin.
DATA_in simple words data can be information or facts related to anything.
Your name, your age, height, etc, are some data related to you.
In the early days of computing, data consisted mainly of text and numbers.
However, in modern day computing, there are types of data, such as audio, images, graphics and
video.
Computers would be pretty useless without data.
Now you know what is data, but do you know what is database? Let me take you to the world of
databases!
Databases are everywhere but you never see them! They are hidden behind tools and services that
you use everyday.
Is it just a random collection of stuff all squeezed in together? No! Database is a systematic
collection of data.
It is structured and organized in a meaningful way.
Ever wondered where Twitter and Facebook put their data? Yeah! It’s all stored in a database.
Where are the contacts in your mobile phone stored? Yup, in your database.

KNOW The Difference!


If the database is a library full of data. Then, DBMS is like the all-knowing librarian.
Database is a collection of data, while DBMS is a management system.
DBMS helps in managing and organizing data efficiently.
Database Management System, also known as DBMS, is a collection of programs which enables
users.
- To create a database
- Access the database
- Manipulate the data
It also provides protection and security to the database.

Let’s get to know the difference between DBMS and RDBMS!


Databases contain files (documents, spreadsheets, photos, etc), while Relational Database
Management Systems (RDBMS) contain tables.
So they ain’t the same thing! Majority of us fail to understand this key difference.
Also relational databases have a certain relation between the tables.

Can a program be both DBMS and RDBMS?


Yeah buddy! Just make sure that it’s capable of storing data in the form of files as well as tables.
Most applications these days are both DBMS and RDBMS.

Understanding the hierarchy of RDBMS


A table contains rows and columns and the bisecting cell is known as ‘field’. Horizontal rows are
also know as records.
First comes RDBMS, under it-tables with rows and columns.
Columns define the data that the rows under it must hold.

Let’s move ahead!


Now you know what Database, DBMS, RDBMS, and tables are…
Let’s move ahead.

Let’s understand Entity Relationship (ER) Diagram!


Entity Relationship model is the structured representation of a database with the help of a diagram.
An entity can be a place, person or it may be an object with a conceptual existence-college, job,
course.
If we consider student as an Entity, then Student ID, Name, age, etc. are attributes describing the
entity.
You first identify the entity, next scribble on ER diagram and finally convert the diagram into a
table.
ER Diagram is solely for your reference. It enables better planning of attributes, keys and other
crucial aspects.
Also, remember that ER is just a visual representation of the database used by designers. It doesn’t
exist anywhere as such.
What actually do ER Diagrams do?
ER Diagram is used to identify
Entity – the larger block about which you wish to store data (College)
Attributes – A column name and the fields that fall under it (College name, courses, students,
teachers, etc.)
Relationship – The link between 2 tables
This makes life easier for the perplexed database designer.

According to you, what relationships does an Diagram DOES NOT represent?


That’s right! Any relationship would require some entity to be on either side.

Understanding attributes
An attribute pushes you deeper into the table’s properties.
If ‘Student’ is the entity, then the attributes could be Student ID, Student Name and so on.
Attributes are like further classification of a Table.

Pick the false statement

ER Diagram showcases relationships between entities.

Here’s something you need to know!


RDBMS contains a bunch of Tables
All the tables under the RDBMS are interrelated.

Perfect! Multiple tables in a database can be interrelated.

A table in SQL is A unique set of data.


Table do not contain Queries
Queries are used to manipulate data as we will see in upcoming sections.
UNDERSTANDING ER
How to design a database?
Always start with identifying the entity and spending time on an ER Diagram.
You need to make the diagram just once.
Once done, it gives a clear picture of what all tables are to be used with the necessary additional
info on each attribute and lots more.

Importance of ER Diagram in the world of Database design.


An ER diagram helps you conceptualize the database.
It lets you identify entities, attributes and relationships.
All of which is crucial in case of RDBMS.

What makes a good ER Diagram?


A good ER diagram is one that helps chalk out a blueprint for a database.
It has got to be something that can easily be converted into a table. Always make sure to identify the
keys in the ER diagram.
This makes things easier.
But what are keys? It means nothing but identifying unique columns of all tables. Say, Student_ID in
a table of StudentInfo

Understanding ER diagram representations


Rectangle denotes entity, rhombus denote actions, Elliptical denotes attributes.

Although it may look similar to the flowchart, it isn’t.

Let’s get deeper into the sea!


So what’s this stuff called ‘entity’?
Entity is the biggest data item! It’s like shipping container.

So what’s the deal with this ‘Attribute’ stuff?


Attributes are the individual corrugated boxes, loaded in the shipping container!
It’s part of the entity.

Pick the correct statement


In a table, the 2 dimensional intersections of a column and row is called field
Which of this is a conceptual element? Entity Relationship Diagram
Pick the one that’s not an attribute_Smartphone
Choose the one of the following which is an Entity_College

An entity in a ER Diagram is denoted by Rectangle shape.


Always start designing a database with ER Diagram
Address is an Attribute

Time to learn some Table Manners!


Nah! We ain’t dining with the Queen.
But we’ll get to learn something better!

Creating of a table
Ever wondered where does a Table come from?
From an entity! The larger chunk! Let’s say the entity is ‘College’!
You gotta think what data a college would want to store! It’s super easy! Just break the larger chunk
into smaller ones.
So a college may want to store various groups of data such as Part Time Teachers, Full Time
Teachers, Applicants, Students, Courses etc.
Let’s now head tp the Naming Ceremony!

Naming Conventions
Here are the ground rules to name a table
First off, the rules remain the same for tables and attributes (column names). The name has to have
something to do with its superset.
So we are likely to use more than one word. High alert! No spaces between them!
Capitalization of the first word can be done to make it more readable.
For example ‘CollegeTeachers’ is fine.
But ‘College Teachers’ is NOT!!

Constituent of a table
A 7-Course meal?
Well, No No! in SQL there are only rows and columns.
But we’ve got nicknames for them!
We all fields or columns as attributes. We call rows as records and also call them Tuples.

Attributes
Let’s talk about attributes and what makes a good one.
Keep it descriptive and relevant.
No two Attributes in a table can have the same name.
Also, tables are called ‘Relations’ sometimes

Which of the following is not a mandatory requirement, to create a Table?


ER Diagram

Creating table
Now that we have the tools! Let’s talk business!

Rules to Create a Table


What do we need before we create a table?
Simply put, we should have a database in the beginning in which a table would be created.

Creating database
By default the SQL server shows ‘Master’ as Database
To change this, we need to give out the right command!
The command is-
Create Database_____
Fill in the blank with the desired name
Then hit ‘Enter’ and we are halfway through

Changing Database
Your Database by default is set to “Master”
To change this default Database to your desired one, say ‘Employee’. You need a command
So type – use Employee – and voila! The default database is changed.

Creating a table
Just type in – Create Table TableName
Replace ‘TableName’ with the desired name of the table
Well, more about it later!
This is just to give you a clue of how to create tables.

Done with the basics!


Let’s round up and move furhter!

Rows are also called Record


The other name for relations is table
Atta boy! In RDBMS Tables are the Relations, and also referred to, by that name.

Rearrange the following in the right order


Create database
Change default database
Create table

To create a database ‘Employee’ you need CREATE Database Employee command

Time to march further soldier!


Aye! Aye!
“Fundamental Database MySQL”
MySQL adalah sistem manajemen basis data relasional (RDBMS) yang populer dan banyak
digunakan di seluruh dunia. MySQL digunakan untuk mengelola, menyimpan, dan mengakses data
dalam aplikasi dan situs web.
MySQL memiliki fitur seperti dukungan multi-pengguna, transaksi, dan dukungan untuk bahasa
pemrograman seperti PHP, Python, dan Java. MySQL juga dikenal sebagai sistem manajemen basis
data open-source yang artinya dapat diunduh dan digunakan secara gratis oleh siapa saja.
MySQL dapat digunakan di berbagai sistem operasi seperti Windows, Linux, dan MacOS. Dengan
kemampuan untuk menyimpan data dalam jumlah besar dan menyediakan fitur untuk
mengoptimalkan kinerja database, MySQL menjadi pilihan populer bagi banyak organisasi dan
perusahaan dalam pengelolaan data mereka.

IT Support Coding Studio


Apabila selama belajar mengalami kendala teknis, dapat bertanya kepada IT Support Coding Studio
melalui link WhatsApp berikut:
https://wa.me/message/FVT5JNNKAVX6H1

Apa tipe data yang cocok untuk menyimpan DateOfBirth?

INT
DECIMAL
VARCHAR
DATETIME
Correct
Apa tipe data yang cocok untuk menyimpan Salary?

INT
DECIMAL
VARCHAR
Correct
Apa tipe data yang cocok untuk menyimpan Stock?

INT
DECIMAL
VARCHAR
DATETIME
Correct
Yang mana merupakan query untuk memberikan referensi kolom kepada table lain?

REFERENCES/FOREIGN KEY
PRIMARY KEY
CONSTRAINT
CHECK
Correct
Yang mana merupakan query untuk memberikan syarat kepada suatu kolom?

REFERENCES/ FOREIGN KEY


PRIMARY KEY
CONSTRAINT
CHECK
Correct
Yang mana merupakan query untuk mengecek syarat yang akan diterapkan kepada kolom?

REFERENCES/ FOREIGN KEY


PRIMARY KEY
CONSTRAINT
CHECK
Correct
Setiap table harus memiliki …?

REFERENCES/ FOREIGN KEY


PRIMARY KEY
CONSTRAINT
CHECK
Correct
Yang mana merupakan query untuk memperbarui nilai kolom di tabel yang terkait secara otomatis
ketika nilai kolom dalam tabel utama diubah?

ON UPDATE CASCADE
ON UPDATE SET NULL
ON UPDATE RESTRICT
ON UPDATE SET DEFAULT
Correct
Yang mana merupakan query untuk untuk mengubah nilai kolom yang terkait di tabel yang
memiliki kunci asing ke NULL saat nilai pada kolom yang diacu dihapus?

ON DELETE CASCADE
ON DELETE SET NULL
ON DELETE RESTRICT
ON DELETE SET DEFAULT
Correct
Yang mana merupakan query untuk untuk mencegah perubahan nilai pada kolom utama jika masih
ada baris pada tabel terkait yang memiliki referensi kunci asing.?

ON UPDATE CASCADE
ON UPDATE SET NULL
ON UPDATE RESTRICT
ON UPDATE SET DEFAULT
Correct
Yang mana merupakan query untuk mengambil data dari table?

SELECT
UPDATE
DELETE
INSERT
Correct
Yang mana merupakan query untuk memasukkan data ke table?

SELECT
UPDATE
DELETE
INSERT
Correct
Yang mana merupakan query untuk memperbarui data di table?

SELECT
UPDATE
DELETE
INSERT
Correct
Yang mana merupakan query untuk menghapus data di table?

SELECT
UPDATE
DELETE
INSERT
Correct
Disebut apa symbol ini “*”?
Asteriks
Obelisk
Semi-Colon
MySQL
Correct
Simbol apa yang digunakan untuk mengambil semua kolom dari table?

;

*
()
Correct
Simbol apa yang digunakan untuk memberikan catatan?

;

*
()
Correct
Simbol apa yang digunakan untuk mengakhiri suatu query?

;

Correct
Apa perintah SQL yang digunakan untuk menampilkan semua data dari tabel MsEmployee?

select * from MsEmployee;


select all from MsEmployee;
show table MsEmployee;
show all from MsEmployee;
Correct
Apa perintah SQL yang digunakan untuk menambahkan data baru ke dalam tabel MsMusicInsType?

insert into MsMusicInsType values ('MT006','Saxophone');


insert into MsMusicIns values ('MT006','Saxophone','4250000','15','MT001');
insert into MsMusicInsType ('Saxophone');
add into MsMusicInsType values ('MT006','Saxophone');
Correct

Apa itu MySQL?

Sebuah database open source


Sebuah bahasa pemrograman
Sebuah aplikasi pengolah kata
Sebuah sistem operasi
Correct
Apa kegunaan dari MySQL?

Untuk membuat website


Untuk mengakses internet
Untuk menyimpan dan mengelola data
Untuk membuat aplikasi desktop
Correct
Apa perbedaan antara MySQL dan SQL Server?

MySQL berbasis open source, sementara SQL Server proprietary


MySQL hanya dapat digunakan pada platform Windows, sementara SQL Server dapat digunakan
pada berbagai platform
MySQL memiliki fitur yang lebih lengkap daripada SQL Server
MySQL lebih mahal daripada SQL Server
Correct
Apa perbedaan antara database dan tabel dalam MySQL?

Database merupakan kumpulan tabel, sedangkan tabel merupakan kumpulan field


Database hanya dapat menyimpan satu jenis data, sedangkan tabel dapat menyimpan berbagai
jenis data
Database digunakan untuk menyimpan dan mengelola data, sedangkan tabel digunakan untuk
melakukan query terhadap data
Tidak ada perbedaan antara database dan tabel
Correct
Apa yang dimaksud dengan primary key dalam MySQL?

Sebuah field yang menunjukkan relasi antara dua tabel


Sebuah field yang hanya dapat diisi dengan nilai unik
Sebuah field yang menunjukkan tipe data dari suatu kolom
Sebuah field yang menunjukkan jumlah data yang tersimpan dalam tabel
Correct
Apa yang dimaksud dengan foreign key dalam MySQL?

Sebuah field yang menunjukkan relasi antara dua tabel


Sebuah field yang hanya dapat diisi dengan nilai unik
Sebuah field yang menunjukkan tipe data dari suatu kolom
Sebuah field yang menunjukkan jumlah data yang tersimpan dalam tabel
Correct
Apa yang dimaksud dengan index dalam MySQL?

Sebuah field yang menunjukkan relasi antara dua tabel


Sebuah field yang hanya dapat diisi dengan nilai unik
Sebuah field yang menunjukkan tipe data dari suatu kolom
Sebuah struktur data yang digunakan untuk mempercepat pencarian data dalam tabel
Correct
Apa yang dimaksud dengan query dalam MySQL?

Sebuah perintah untuk menambahkan data ke dalam tabel


Sebuah perintah untuk mengubah data yang sudah ada di dalam tabel
Sebuah perintah untuk menghapus data dari tabel
Sebuah perintah untuk mengambil data dari tabel
Correct
Apa yang dimaksud dengan stored procedure dalam MySQL?

Sebuah fungsi yang dapat menghasilkan nilai berdasarkan input yang diberikan
Sebuah prosedur untuk mengubah struktur tabel
Sebuah prosedur yang dijalankan secara otomatis saat database diakses
Sebuah prosedur yang tersimpan di dalam database dan dapat dipanggil secara berulang
Correct
Apa yang dimaksud dengan view dalam MySQL?

Sebuah tampilan grafis dari data dalam tabel


Sebuah struktur data yang mengatur tampilan pada website
Sebuah tabel virtual yang dibuat dari hasil query
Sebuah database kecil yang berisi data spesifik
Correct

Menguasai microsoft excel sangat penting karena dapat mempermudah pengelolaan data,
meningkatkan efisiensi kerja, menyediakan alat analisis data yang kuat, diperlukan dalam banyak
pekerjaan dan dapat meningkatkan kesempatan karir. Dengan excel, pengguna dapat mengurutkan,
memfilter, dan menghitung data dengan mudah, serta menggunakan rumus dan fungsi untuk
mengotomisasi tugas yang berulang. Excel juga menyediakan alat analisis data yang kuat seperti
grafik dan tabel pivot, yang membantu pengguna memahami dan mengambil keputusan
berdasarkan data. Oleh karena itu, kemampuan menggunakan excel diperlukan dalam banyak
bidang pekerjaan seperti keuangan, akuntansi, manajemen proyek, dan analisis data, dan dapat
meningkatkan kesempatan karir.

Microsoft excel adalah sebuah aplikasi pengolah angka yang sangat populer dan banyak digunakan
diseluruh dunia. Excel dapat digunakan untuk mengelola data, menganalisis data, membuat grafik
dan laporan, serta melakukan banyak tugas lainnya yang berhubungan dengan angka.

Berikut adalah beberapa kegunaan excel:


1. Membuat tabel data: Excel dapat digunakan untuk membuat tabel data yang dapat diurutkan,
difilter, dan dihitung secara otomatis.
2. Analisis data: Excel dapat digunakan untuk melakukan analisis data seperti pemrosesan data
statistik, peramalan, dana analisis regresi.
3. Membuat grafik: Excel dapat digunakan untuk membuat grafik seperti grafik batang, garis, dan
pie chart, yang memudahkan untuk memvisualisasikan data.
4. Pengelolaan keuangan: Excel dapat digunakan untuk mengelola keuangan seperti menghitung
pengeluaran, pemasukan, dan laba rugi perusahaan.
5. Pembuatan laporan: Excel dapat digunakan untuk membuat laporan seperti keuangan, laporan
penjualan, dan laporan produksi.
6. Membuat jadwal: Excel dapat digunakan untuk membuat jadwal seperti jadwal proyek, jadwal
kerja, dan jadwal pengiriman.

Tips mahir excel


Berikut adalah beberapa tips agar mahir menggunakan excel:
1. Pelajari dasar-dasar excel: Pastikan untuk mempelajari dasar-dasar excel, seperti fungsi dasar,
rumus, formatting, dan penggunaan tabel.
2. Gunakan shortcut: Gunakan shortcut keyboar untuk mempercepat pekerjaan Anda. Anda dapat
menghemat waktu dengan menekan tombol-tombol tertentu untuk melakukan tindakan tertentu
seperti mengcopy, mempaste, dan memformat.
3. Pelajari rumus dan fungsi excel: Pelajari rumus dan fungsi excel yang umum digunakan seperti
SUM, AVERAGE, COUNT, IF, dan VLOOKUP. FUngsi-fungsi ini sangat berguna untuk melakukan
perhitungan dan analisis data.
4. Gunakan fitur formatting excel: Excel memiliki banyak fitur-fitur formatting yang dapat
memperindah dan memperjelas tampilan tabel Anda, seperti pengaturan warna, pengaturan huruf,
dan border.
5. Pelajari Pivot Tables: Pelajari cara menggunakan Pivot Tables untuk melakukan analisis data dan
merangkum data dengan cepat dan mudah.
6. Gunakan fitur Filter dan Sort: Gunakan fitur filter dan sort untuk menyaring dan mengurutkan
data sesuai kebutuhan Anda.
7. Gunakan chart dan grafik: Excel memiliki banyak jenis chart dan grafik yang dapat membantu
Anda memvisualisasikan data dengan mudah.
8. Pelajari bagaimana menggunakan Macro: Macro dapat membantu Anda mempercepat pekerjaan
dengan merekam tindakan yang sering dilakukan dan menjalankannya secara otomatis.
9. Gunakan fitur Data Validation: Gunakan fitur Data Validation untuk memastikan bahwa data yang
dimasukkan pada tabel Anda benar dan konsisten.
10. Teruslah berlatih: Praktek membuat sempurna. Teruslah berlatih dengan membuat tabel,
menghitung data, dan menggunakan berbagai fitur Excel. Semakin sering Anda menggunakan Excel,
semakin mahir Anda akan menjadi.

You might also like