2024-11-19 16:19:58 +08:00

15 lines
572 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

sqlcmd -S localhost -U sa -P '<123123Aa!@>'
在数据库 MyDb 中,创建两张表 t_user1 t_user2 ,表结构如下,请为两张表分别创建主键约束, t_user1 的主键为 userId t_user2 的主键为联合主键,将字段 name 和 phone 作为 t_user2 的联合主键。
CREATE DATABASE MyDb;
go
USE MyDb;
go
CREATE TABLE t_user1 (userId INT PRIMARY KEY, name VARCHAR(32), password VARCHAR(32) ,phone VARCHAR(11),email VARCHAR(32));
go
CREATE TABLE t_user2 (name VARCHAR(32), phone VARCHAR(11), email VARCHAR(32), PRIMARY KEY (name, phone));
go