早教吧 育儿知识 作业答案 考试题库 百科 知识分享

writeaquerysql~toverifywhetherthecombinationofthetwocolums(eg.DateandName)istheprimary/Foreignkeyofthetable?这是一个面试问题当时看到有点儿懵回来google也没找到答案

题目详情
write a query sql~
to verify whether the combination of the two colums (eg.Date and Name) is the primary/Foreign key of the table?
这是一个面试问题 当时看到有点儿懵 回来google也没找到答案


▼优质解答
答案和解析
you can try to insert two records which have the same combination value,
if the system allows you to do so, the two colums are certainly not the PK or FK
if the operation is rejected, then you'll know the answer~
this method is only for trial and error :)
if you want to do this in batches, I'm afraid I cannot help you then.
Try flyingFish211's sql~