SQL Server toàn tập (ok)
Cài đặt
Khởi động mysql


Lấy tên host

Cài đặt SQL Server 2019

Sau khi cài đặt Cài đặt SQL Server 2019 nó sẽ tự có SQL Server Configuration Manager



Tạo bảng và thêm dữ liệu



Thêm database bằng lệnh
USE master
GO
IF NOT EXISTS (
SELECT name
FROM sys.databases
WHERE name = N'TutorialDB'
)
CREATE DATABASE [TutorialDB]
GO


Thêm table bằng lệnh
USE [TutorialDB]
-- Create a new table called 'Customers' in schema 'dbo'
-- Drop the table if it already exists
IF OBJECT_ID('dbo.Customers', 'U') IS NOT NULL
DROP TABLE dbo.Customers
GO
-- Create the table in the specified schema
CREATE TABLE dbo.Customers
(
CustomerId INT NOT NULL PRIMARY KEY, -- primary key column
Name [NVARCHAR](50) NOT NULL,
Location [NVARCHAR](50) NOT NULL,
Email [NVARCHAR](50) NOT NULL
);
GO

Query the table and view the results
-- Select rows from table 'Customers'
SELECT * FROM dbo.Customers;

Thêm dữ liệu bằng lệnh
-- Insert rows into table 'Customers'
INSERT INTO dbo.Customers
([CustomerId],[Name],[Location],[Email])
VALUES
( 1, N'Orlando', N'Australia', N''),
( 2, N'Keith', N'India', N'keith0@adventure-works.com'),
( 3, N'Donna', N'Germany', N'donna0@adventure-works.com'),
( 4, N'Janet', N'United States', N'janet1@adventure-works.com')
GO

Một lệnh để chèn vào
INSERT INTO countries (ID, Country, Gold, Silver, Bronze) VALUES
('1', 'Andorra 1', '1', '1', '3')

Last updated
Was this helpful?