FAQ Database Discussion Community


add new column to existing Composite Unique Key

mysql,unique-constraint,composite-key,alter,unique-index
I have table named "room" , and it has the following composite unique key room_acId_levelId_year_name_unique formed from FOUR columns : acId levelId year name And I want add column isLevel to that key without drop and recreate it The new key should like this: room_acId_levelId_year_name_isLevel_unique with the following columns :...

Can prime attributes depend on each other?

database,primary-key,normalization,composite-key
I have a relation R{id, building, floor, sequence, capacity} where: (building,floor,sequence) -> id id -> (building,floor,sequence) (building,floor,sequence) -> capacity id -> capacity It seems that this doesn't violate any normal form. However, is it really ok for id to depend on (building,floor,sequence) and vice versa even though id is the...

Composite unique index

javascript,indexeddb,composite-key
I have an object store which contains 3 indices, which are name,value and userid. How can I create a composite unique index from name and userid? This is what I tend to do: var objectStore = database.createObjectStore('data',{keyPath : ['name','userid']}); objectStore.createIndex('name','name'); objectStore.createIndex('value','value'); objectStore.createIndex('userid','userid'); Is keyPath good enough? Do I need to...

Sharing composite foreign key based on the same columns across multiple tables in MS SQL Server

sql,sql-server,foreign-keys,composite-key
I have database with multiple tables which contains information about different instruments (Currencies, Funds, Equities etc.). All instruments have Type and Id fields which represents uniquie key for instrument. And I have one more table InstrumentMeta with collects statistic information about all instruments wich has pair (Type,Id) as a primary...

Using Cassandra for time series data

cassandra,time-series,composite-key
I'm on my research for storing logs to Cassandra. The schema for logs would be something like this. EDIT: I've changed the schema in order to make some clarification. CREATE TABLE log_date ( userid bigint, time timeuuid, reason text, item text, price int, count int, PRIMARY KEY ((userid), time) -...

Cassandra compact storage option with compound keys

cassandra,composite-key
How compact storage works in case of having a table like: Table Index { userid keyword score fid PRIMARY KEY (userid, keyword, score) } Do not pay attention on the syntax errors of my table:) let' assume there is one keyword containing 6 fID divided to 3 groups of different...