我想从表中删除主键约束mytable。
在 Mysql 中,我们可以删除主键约束,如
ALTER TABLE *mytable* DROP PRIMARY KEY
Run Code Online (Sandbox Code Playgroud)
如何在 SQL Server 中执行此操作?
感谢您提前回复。:)
注意:我在 SQL Server 中有一个表列表来删除主键约束。主键约束是否有任何默认名称
create table mytable
(
column_a integer not null,
column_b integer not null,
primary key (column_a, column_b)
);
Run Code Online (Sandbox Code Playgroud) 我正在寻找Java中的(预定义的)数据结构,它将删除节点之后的所有元素.下面给出的样本表示.
例如:
在删除之前
head
?>1 -> 2 -> 3 -> 4 -> 5 -> 6 ->7
Run Code Online (Sandbox Code Playgroud)
删除后
removeAllFrom(5)
head
?>1 -> 2 -> 3 -> 4
Run Code Online (Sandbox Code Playgroud)
我查了很多java DS,但是在java中找不到完美的.
(1.优选java.util中的数据结构.
2.头部和迭代的插入是我正在使用的其他操作)
谢谢您的帮助 :)
编辑 - 1
找到指定要删除的元素后(在示例中为5),我们只需要删除下一个节点之间的链接.
我检查了给出的答案的实现,但在这两种情况下,它分别删除每个节点.只是好奇知道任何其他方式来做到这一点.:)
public void clear() {
removeRange(0, size());
}
protected void removeRange(int fromIndex, int toIndex) {
ListIterator<E> it = listIterator(fromIndex);
for (int i=0, n=toIndex-fromIndex; i<n; i++) {
it.next();
it.remove();
}
}
Run Code Online (Sandbox Code Playgroud) class ServerSocket{
....
public ServerSocket(int port) throws IOException {
this(port, 50, null);
}
....
}
Run Code Online (Sandbox Code Playgroud)
我知道这个关键字用于表示活动对象或当前对象.在这段代码中,"this"的含义是什么?我得到这个代码(在这里)
java ×2
constraints ×1
constructor ×1
database ×1
linked-list ×1
mssql-jdbc ×1
primary-key ×1
sql ×1
this ×1