Tag Info

New answers tagged

0

It would have been great if your sqlfiddle data would have been in English... If the activities aer bound to a single location, you could use your current approach. But if there's a chance that one activity can be referenced to more than one location you should use a separate table to show such a reference (using foreign keys to the primary keys of your ...


1

Your sql query is wrong: - Assume there is a student s1 who has passed one exam after '2000-01-01' and none before. Your query results in {s1} - {} = {s1}. This will be a false positive. - Assume there is a student s1 that passed three exams after '2000-01-01' and one exam before. Your query results in {s1} - {s1} = {}. This will be a false ...


0

(sorry for english. i'm study) Is wery simple. You need have "cardinality hole" structure you need to have 2 column 1) pk = 32bit int 2) order = 64bit bigint (BIGINT, NOT DOUBLE!!!) insert/update 1) when you insert first new record you must set order = round(max_bigint / 2). 2) if you insert in beginning of the table you must set order = round("order ...


0

You could reverse the relationship between passenger and ticket so that the ticket has a nullable FK to the passenger. When you create a new trip, create ticket entries for the number of passengers in the trip / seats on the bus. Then relate a passenger to each ticket as the ticket is sold. When a trip has no more tickets with an empty passenger id that trip ...


0

A foreign key (FK) is a column or combination of columns that is used to establish and enforce a link between the data in two tables. You can create a foreign key by defining a FOREIGN KEY constraint when you create or modify a table. A FOREIGN KEY constraint does not have to be linked only to a PRIMARY KEY constraint in another table; it can also be ...


2

A foreign key is a type of constraint. The purpose of constraints is to make sure that data in tables follows certain rules. You use foreign key constraints to ensure that child data has parent data. You can use it to either prevent orphaning child records or to facilitate cascade deletes or updates.


0

First create a table for reference id if it does not exist | ref_id | int(11) | NO | PRI | NULL | auto_increment | | reference_id | int(11) | YES | | NULL | | then create another table to store the types | type_id | int(11) | NO | PRI | NULL | auto_increment | | type ...


0

A better design would be to have a single table to hold all the parties to a payment. If necessary, sub-type this table so companies, proprietors and customers have their own, unique sets of columns (or a separate, related table). The payments table will then have two foreign keys to Parties, let's call them PaymentFromPartyID and PaymentToPartyID, along ...


2

is this what business process of yours? that must be document table : create table document ( `id` int unsigned auto_increment, `title` varchar(128) not null, primary key(id) ); block table create table block ( `id` int unsigned auto_increment, `id_document` int // foreign key to document primary key(id) ); ...



Top 50 recent answers are included