如何在 SQL Server 2008 中创建复合主键 [英] How to create composite primary key in SQL Server 2008

查看:44
本文介绍了如何在 SQL Server 2008 中创建复合主键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 SQL Server 2008 中创建表,但我不知道如何创建复合主键.我怎样才能做到这一点?

I want to create tables in SQL Server 2008, but I don't know how to create composite primary key. How can I achieve this?

推荐答案

create table my_table (
     column_a integer not null,
     column_b integer not null,
     column_c varchar(50),
     primary key (column_a, column_b)
);

这篇关于如何在 SQL Server 2008 中创建复合主键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆