Search
 
SCRIPT & CODE EXAMPLE
 

SQL

how to define a composite primary key in sql

CREATE TABLE person(id INT, 
					name TEXT,
					PRIMARY KEY (id, name)
				   );
Comment

composite primary key sql

CREATE TABLE student
(rollNumber INT, 
name VARCHAR(30), 
class VARCHAR(30), 
section VARCHAR(1), 
mobile VARCHAR(10),
PRIMARY KEY (rollNumber, mobile)); -- This thing
Comment

sql composite primary key

CREATE TABLE voting (
  QuestionID NUMERIC,
  MemberID NUMERIC,
  PRIMARY KEY (QuestionID, MemberID)
);
Comment

how to define a non primary composite key in sql

ALTER TABLE dbo.YourTable
ADD CONSTRAINT UC_YourTable_Col1_Col2
UNIQUE(Col1, Col2)
Comment

composite primary key sql

CREATE TABLE student
(rollNumber INT, 
name VARCHAR(30), 
class VARCHAR(30), 
section VARCHAR(1), 
mobile VARCHAR(10),
PRIMARY KEY (rollNumber, mobile));
Comment

PREVIOUS NEXT
Code Example
Sql :: query concatenate 
Sql :: oracle list user grants 
Sql :: Uncaught Error: Cannot use object of type mysqli_result as array 
Sql :: grant mysql 
Sql :: oracle asynchronous update 
Sql :: installing postgresql ubuntu 
Sql :: alter tablespace add datafile autoextend 
Sql :: postgres concat_ws 
Sql :: t sql check column exists 
Sql :: retrieve meaning 
Sql :: backup postgres database 
Sql :: data directory postgresql 
Sql :: like sql 
Sql :: sysdate in oracle sql 
Sql :: add foreign key constraint in postgresql 
Sql :: create function in postgresql 
Sql :: To change the database owner in SQL server 
Sql :: sql get month name 
Sql :: select latest entry in sql table 
Sql :: ubuntu mysql cannot connect to database server remote 
Sql :: coalesce postgresql 
Sql :: SET NOCOUNT ON; 
Sql :: sql truncate statement 
Sql :: find duplicates mysql 
Sql :: is mysql and sqlite same 
Sql :: oracle trigger after logon on schema 
Sql :: select row from mysql where date more than 30 days 
Sql :: plsql triggers 
Sql :: postgres cast as currency format 
Sql :: postgres json to string 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =