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
-- 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

插入数据:

-- 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'[email protected]'),
   ( 3, N'Donna', N'Germany', N'[email protected]'),
   ( 4, N'Janet', N'United States', N'[email protected]')

查询数据:

-- Select rows from table 'Customers'
SELECT * FROM dbo.Customers;

由此可以看到,创建表、数据插入、查询成功。如下截图。

USE [TutorialDB1] -- 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 -- 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 -- 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'[email protected]'), ( 3, N'Donna', N'Germany', N'[email protected]'), ( 4, N'Janet', N'United States', N'[email protected]')

创建第2个数据库TutorialDB2并插入数据:

USE master
IF NOT EXISTS (
   SELECT name
   FROM sys.databases
   WHERE name = N'TutorialDB2'
CREATE DATABASE [TutorialDB2]
USE [TutorialDB2]
-- 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
-- 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
-- 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'[email protected]'),
   ( 3, N'Donna', N'Germany', N'[email protected]'),
   ( 4, N'Janet', N'United States', N'[email protected]')

数据插入成功。且可以通过SQL Server Management Studio(SSMS)看到其中的两个数据库的Schema和Table。如下截图。

使用Session Manager登录EC2 Linux

使用Session Manager登录位于内网的EC2的RDP远程桌面

使用EC2 Instance Connect网页界面SSH工具登陆EC2 Linux

如何在IAM上生成AKSK

Windows和Linux安装CloudWatch Agent增加内存和磁盘监控

使用ec2-instance-selector查询规格

多种方式查询最新AMI

EC2 Linux 安装Mate GUI

导入CentOS的AMI到云上启动失败需要安装ENA/NVMe驱动的说明

Level 200系列:

EKS 101 & 201 系列合集(更新到1.30版本)

ECS 201系列

Kinesis 101系列三部曲

CloudFront汇总

保护API Gateway安全三部曲

查询各服务IP范围

在EC2 Windows上通过WSL运行Linux

Level 300系列:

Gateway Load Balancer 集中式和分布式流量检测Quickstart

CloudFront签名

更多文章请使用站内搜索输入服务名称查找

2024贵在学习

September 2024
1234567 891011121314 15161718192021 22232425262728 2930