Insert! informasi seputar selebriti mmmmuuuahhh

INSERT INTO
Insert itu digunakan untuk memasukkan data kedalam tabel
SQL INSERT INTO Syntax SQL Sintaks INSERT INTO
Bentuk pertama tidak menentukan nama kolom di mana data yang akan disisipkan, hanya nilai-nilai mereka: Bentuk Pertama Nama Kolom regular tidak menentukan di mana data yang akan disisipkan Yang, Hanya Nilai-Nilai mereka:
INSERT INTO table_name
VALUES (value1, value2, value3,…)

Bentuk kedua menetapkan kedua nama kolom dan nilai-nilai yang akan dimasukkan:

INSERT INTO table_name (column1, column2, column3,…)
VALUES (value1, value2, value3,…)

________________________________________
SQL INSERT INTO contohnya
Saya punya contoh nie:
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
Contoh lain:
INSERT INTO Persons
VALUES (4,’Nilsen’, ‘Johan’, ‘Bakken 2’, ‘Stavanger’)

P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger

________________________________________
Insert data harus spesifik nama coloum
INSERT INTO Persons (P_Id, LastName, FirstName)
VALUES (5, ‘Tjessem’, ‘Jakob’)
Lihat contoh ini:
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger
5 Tjessem Jakob

Pernyataan UPDATE
Update digunakan untuk mengganti atau merubah data
SQL UPDATE Syntax SQL UPDATE Sintaks contoh
UPDATE table_name
SET column1=value, column2=value2,…
WHERE some_column=some_value
________________________________________
SQL UPDATE Example
Lihat tabel ini:
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger
5 Tjessem Jakob
Sql sintaxnya seperti ini
UPDATE Persons
SET Address=’Nissestien 67′, City=’Sandnes’
WHERE LastName=’Tjessem’ AND FirstName=’Jakob’
Lihat setelah diupdate
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger
5 Tjessem Jakob Nissestien 67 Sandnes

________________________________________
SQL UPDATE harus Hati-hati
Lihat coloum jangan sampai salah
UPDATE Persons
SET Address=’Nissestien 67′, City=’Sandnes’
Lihat contoh berikut:
P_Id LastName FirstName Address City
1 Hansen Ola Nissestien 67 Sandnes
2 Svendson Tove Nissestien 67 Sandnes
3 Pettersen Kari Nissestien 67 Sandnes
4 Nilsen Johan Nissestien 67 Sandnes
5 Tjessem Jakob Nissestien 67 Sandnes

Pernyataan DELETE
Digunakan untuk menghapus data
SQL DELETE Syntax SQL DELETE Sintaks
DELETE FROM table_name
WHERE some_column=some_value
________________________________________
Contoh SQL DELETE
Tabel berikut:
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger
5 Tjessem Jakob Nissestien 67 Sandnes
Ingin menghapus salah satu data contohnya:
Berikut contohnya:
DELETE FROM Persons
WHERE LastName=’Tjessem’ AND FirstName=’Jakob’
Dan ini yang telah dihapus:
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger

________________________________________
Menghapus semua rows
Untuk menghapus semua rows adalah:
DELETE FROM table_name

or

DELETE * FROM table_name

Ikhsan Ramadhan

Leave a Reply

Your email address will not be published. Required fields are marked *

Powered By WordPress. A Magnetic theme by Devfloat