• Tidak ada hasil yang ditemukan

Insert Data Only in Specified Columns

N/A
N/A
Protected

Academic year: 2023

Membagikan "Insert Data Only in Specified Columns"

Copied!
3
0
0

Teks penuh

(1)

Now first Go to http://localhost/phpmyadmin/

SQL Queries:

For creating a database:

CREATE DATABASE database_name;

Create Table:

CREATE TABLE table_name (

column1 data_type(size), column2 data_type(size), column3 data_type(size), ....

);

(2)

Example Query:

This query will create a table named Students with three columns, ROLL_NO, NAME and SUBJECT.

CREATE TABLE Students (

ROLL_NO int(3) PRIMARY KEY, NAME varchar(20),

SUBJECT varchar(20) );

Inserting data in the table:

INSERT INTO table_name

VALUES (value1, value2, value3, ...);

Insert Data Only in Specified Columns

INSERT INTO Customers (CustomerName, City, Country) VALUES ('Cardinal', 'Stavanger', 'Norway');

Create Table Using Another Table

A copy of an existing table can also be created using CREATE TABLE.

The new table gets the same column definitions. All columns or specific columns can be selected.

CREATE TABLE new_table

AS (SELECT column_1, column2, ... column_n FROM old_table);

Deleting a Table:

DROP TABLE table_name

(3)

Exercise:

Create the following table:

What’s the difference between CHAR and VARCHAR?

The short answer is: VARCHAR is variable length, while CHAR is fixed length.

Referensi

Dokumen terkait

Bulletin of Monetary Economics and Banking Bank Indonesia Patron Board of Governors, Bank Indonesia Editor-in-Chief Dr.. Perry Warjiyo, Bank Indonesia, Indonesia Managing Editor

The 84th KPPY Combinatorics Seminar Organized by S.Bang, M.Hirasaka, T.Jensen, and M.Siggers Sept 16, 2017 Department of Mathematics, Kyungpook National University Natural Sciences