Skip to content

Commit a050267

Browse files
authored
Create Create Database, Create Table and Insert into
A simple way to start SQL: This code is straightforward and easy to understand. -Create a database -Create a table, Insert into or Insert information into the table, -And finally, select or find the table with the desired information.
1 parent d67750d commit a050267

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
-A simple way to start SQL: This code is straightforward and easy to understand.
2+
-Create a database
3+
-Create a table, Insert into or Insert information into the table,
4+
-And finally, select or find the table with the desired information.
5+
6+
--Create database
7+
create database beginner;
8+
9+
--Create table Employees
10+
create table Employees (
11+
EmployeeID int,
12+
FirstName varchar(30),
13+
LastName varchar(30),
14+
Gender varchar(30),
15+
Age int );
16+
17+
--Create table Salaries
18+
create table Salaries (
19+
EmployeeID int,
20+
JobTitle varchar(30),
21+
Salary int );
22+
23+
--Insert into Employee table and Salaries table
24+
Insert into Employees values
25+
(202401, 'Rhona', 'Santiago', 'Female', 32),
26+
(202402, 'Gino','Yu', 'Male', 34),
27+
(202403, 'Cha','Sy', 'Male', 36);
28+
29+
Insert into Salaries values
30+
(202401, 'Business Analyst', 3000),
31+
(202402, 'Business Analyst', 3000),
32+
(202403, 'Business Analyst', 4000);
33+
34+
--Select Table "Employees"
35+
select *
36+
from Employees
37+
38+
--Select the table "Salaries" even when using another database.
39+
select *
40+
from Beginner.dbo.Salaries

0 commit comments

Comments
 (0)