mysql - SQL CHECK CONSTRAINT .. iS NOT WORKING WITH ME -


my question following :

create new table named frequent travelers (freqtrav). store passengers have taken more 2 trips company. record passenger name, passenger number, address, phone number, total trips , total fare paid. show create table query , insert query. please insert records using subquery (i.e. insert select query).

i worte following query :

        create table freqtrav (      passengernum int(20)      check (passengernum in  (select p.passengernum     passenger p, voyage v     p.passengernum = v.passengernum     group v.passengernum     having count( * ) >2) )      passengername char (20)     address varchar(50)     phonenumber char(20)         totaltrips int (20)          check (totaltrips in  (select count(passengernum)  voyage  group passengernum having count(*) >2))         totalfare int (20)      check (totalfare in ( select sum(fare)  voyage  passengernum in  (select count(passengernum)  voyage  group passengernum having count(*) >2)))         ); 

but it's not working me since tried inserting passengernum did't travel more 2 times , inserted. , have question regarding other columns going okey if value inserted different values in original table or have check constarint same have done total trip , total fare ?

i attached database table @ pic link below http://i.stack.imgur.com/ojzht.png thanks

annoyingly, check constraints aren't implemented in mysql, see check constraint in mysql not working

the check clause parsed ignored storage engines.

(source: mysql reference manual: create table)


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -