sqlserver数据库库表命令
时间: 2023-12-22 13:28:26 浏览: 89
sql server命令
以下是SQL Server数据库表命令的一些例子:
1.创建表
```sql
CREATE TABLE Persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
```
2.删除表
```sql
DROP TABLE Persons;
```
3.修改表结构
```sql
ALTER TABLE Persons ADD Email varchar(255);
```
4.插入数据
```sql
INSERT INTO Persons (PersonID, LastName, FirstName, Address, City)
VALUES (1, 'Doe', 'John', '123 Main St', 'Anytown');
```
5.查询数据
```sql
SELECT * FROM Persons;
```
6.更新数据
```sql
UPDATE Persons SET City='New York' WHERE LastName='Doe';
```
7.删除数据
```sql
DELETE FROM Persons WHERE LastName='Doe';
```
阅读全文