解决与问题相关的查询 [英] solving a problem query related

查看:53
本文介绍了解决与问题相关的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

报价:

如果我们在表中有诸如empid,emname,salary,date之类的字段,让我们假设主键为Empid,我们需要插入薪水一个月一个月

if we have fields such as empid,emname,salary,date in a table let us assume primary key is empid we need to insert the salary month by month how it will be possible

推荐答案

您可以再输入一个年份,并且
将复合主键用作(empid,month,year)
you can take another field year, and
take composite primary key to (empid,month,year)


你好,

如果您将Empid作为主键,则不可能将月薪存储在一个表中.您必须使用另一个表来存储员工的薪水.因为empid是表中的主键,因此不应重复.因此,可以将该主键用作另一个表中的外键,这样就可以了.


例如.
emp(empid,emname)

工资(id,salary,date,fk_empid)
Hello,

If you have empid as a primary key, then it is not possible to store month by month salary in one table. You have to use another table to store the salary of employees. because empid is primary key in the table and it should not duplicated. so use that primary key as a foreign key in another table, then it will possible.


eg.
emp(empid,emname)

salaries(id,salary,date,fk_empid)


这篇关于解决与问题相关的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆