用Python判断节假日,以及节假日的SQL数据文件

这篇具有很好参考价值的文章主要介绍了用Python判断节假日,以及节假日的SQL数据文件。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

为什么要判断节假日?

在我们的日常生活中,节假日是一个重要的组成部分。无论是个人计划还是商业活动,了解特定日期是否为节假日都是非常有用的。在Python中,我们可以使用一些内置的日期和时间模块来判断一个日期是否是法定节假日。

在数据分析工作中,判断节假日的使用场景主要有以下几个方面:

  1. 销售数据分析:对于电商或线下零售商来说,节假日的销售数据可能与其他时间有所不同。通过判断节假日,可以对销售数据进行更准确的趋势分析和预测。
  2. 用户行为分析:在用户行为分析中,节假日的影响可能导致用户行为的变化。例如,节假日期间用户可能更倾向于浏览娱乐内容或进行短途旅行。
  3. 流量分析:对于许多在线业务,例如旅游、电影票预订或在线游戏等,节假日的流量波动是一个重要的分析点。通过判断节假日,可以更好地了解流量变化和用户需求。
  4. 媒体内容推荐:根据节假日的特点,可以为用户推荐相应主题的内容或广告。例如,在春节期间可以加强推荐与家人团聚或相关节日文化的内容。
  5. 市场活动规划:对于市场营销团队来说,节假日是策划活动的好时机。通过判断节假日,可以更精准地定位目标受众和制定营销策略。
  6. 物流配送优化:在物流和配送领域,节假日可能导致配送需求的增加或配送时间的延长。通过判断节假日,可以更好地规划运力和优化配送路线。
  7. 客户服务响应:在客户服务方面,节假日可能导致服务需求的增加或响应时间的延长。通过判断节假日,可以更好地调配资源和服务人员。
  8. 趋势预测:通过判断节假日,可以更准确地预测业务发展趋势和市场变化。例如,对于酒店业,可以利用历史数据预测节假日期间的入住率和房价。
  9. 安全风险预警:在某些领域,例如金融或网络安全,节假日可能带来更多的安全风险。通过数据分析,可以提前发现潜在的安全威胁并进行预警。

综上所述,判断节假日在数据分析工作中具有广泛的应用场景。通过合理利用节假日数据,可以更好地理解用户需求和市场变化,提高业务运营的效率和效果。

python如何判断节假日?

首先,我们需要导入Python的datetime模块。这个模块提供了日期和时间的各种操作,包括日期的比较、计算等。

然后,我们还需要安装chinesecalendar模块,这个模块提供判断某年某月某一天是不是工作日/节假日。 支持 2004年 至 2024年,包括 2020年 的春节延长。

import datetime

from chinese_calendar import is_holiday, is_workday
from chinese_calendar.constants import workdays, holidays

安装chinesecalendar

pip install chinesecalendar

更新chinesecalendar

pip install -U chinesecalendar

由于次年的节假日安排,取决于国务院发布的日程。 所以本项目一般会在国务院更新以后,发布新的版本。 按照以往的经验,一般是每年的 11月 前后发布新版本。

判断节假日和工作日

接下来,我们可以使用is_holiday和is_workday来判断给定的日期是否是法定节假日。

这两个函数接受一个日期对象作为参数,并返回一个布尔值来表示该日期是否为法定节假日。

现在,我们可以使用这个函数来判断任意给定的日期是否是法定节假日。例如:

import datetime

from chinese_calendar import is_holiday, is_workday
from chinese_calendar.constants import workdays, holidays

# 获取当前日期
now_ = datetime.datetime.now()

# 判断当天是否是工作日【正常周内、调休都是工作日】
print(now_.strftime("%Y-%m-%d"), "是否是工作日:", is_workday(now_))

# 判断当天是否是节假日【正常周末、放假都是节假日】
print(now_.strftime("%Y-%m-%d"), "是否是节假日:", is_holiday(now_))

# 判断指定日期是节假日还是工作日
someday = datetime.date(2024, 2, 10)
print(someday.strftime("%Y-%m-%d"), "是否是工作日:", is_workday(someday))
print(someday.strftime("%Y-%m-%d"), "是否是节假日:", is_holiday(someday))

这个示例代码演示了如何使用Python的chinese_calendar模块来判断一个日期是否是法定节假日。你可以根据自己的需求修改日期来使用。

如何修改为SQL数据?

SQL是数据分析中常用的工具,于是乎,我将这些【节假日】、【调休日期】转化为sql语句,并保存到对应的sql文件中,具体代码如下:

import datetime

from chinese_calendar import is_holiday, is_workday
from chinese_calendar.constants import workdays, holidays

# 节假日的中英文名称
day_name_list = [
    ("New Year's Day", "元旦", 1),
    ("Spring Festival", "春节", 3),
    ("Tomb-sweeping Day", "清明", 1),
    ("Labour Day", "劳动节", 1),
    ("Dragon Boat Festival", "端午", 1),
    ("National Day", "国庆节", 3),
    ("Mid-autumn Festival", "中秋", 1)
]
# 制作节假日sql语句
holidays_sql = """insert into holidays(holiday,english_name,chinese_name) values """
for k, v in holidays.items():
    for h in day_name_list:
        if v == h[0]:
            holidays_sql += str(tuple((k.strftime("%Y-%m-%d"), v.replace("'", ""), h[1]))) + ",\n"
            continue
# 替换最后一个逗号为分号
holidays_sql = holidays_sql[:-2] + ";"
with open("./holidays_value.sql", "w", encoding="utf-8") as f:
    f.write(holidays_sql)
    print("holidays_sql写入文件holidays_value.sql成功!")

# 制作调休sql语句
workdays_sql = """insert into workdays(workday,english_name,chinese_name) values """
for k, v in workdays.items():
    for h in day_name_list:
        if v == h[0]:
            workdays_sql += str(tuple((k.strftime("%Y-%m-%d"), v.replace("'", ""), h[1]))) + ",\n"
            continue
# 替换最后一个逗号为分号
workdays_sql = workdays_sql[:-2] + ";"
with open("./workdays_value.sql", "w", encoding="utf-8") as f:
    f.write(workdays_sql)
    print("workdays_sql写入文件workdays_value.sql成功!")

节假日sql数据

节假日表【holidays】创建语句:

CREATE TABLE `holidays` (
  `holiday` varchar(100) NOT NULL,
  `english_name` varchar(100) NOT NULL,
  `chinese_name` varchar(100) NOT NULL,
  PRIMARY KEY (`holiday`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

节假日数据sql语句:

insert into holidays(holiday,english_name,chinese_name) values ('2004-01-01', 'New Years Day', '元旦'),
('2004-01-22', 'Spring Festival', '春节'),
('2004-01-23', 'Spring Festival', '春节'),
('2004-01-24', 'Spring Festival', '春节'),
('2004-01-25', 'Spring Festival', '春节'),
('2004-01-26', 'Spring Festival', '春节'),
('2004-01-27', 'Spring Festival', '春节'),
('2004-01-28', 'Spring Festival', '春节'),
('2004-05-01', 'Labour Day', '劳动节'),
('2004-05-02', 'Labour Day', '劳动节'),
('2004-05-03', 'Labour Day', '劳动节'),
('2004-05-04', 'Labour Day', '劳动节'),
('2004-05-05', 'Labour Day', '劳动节'),
('2004-05-06', 'Labour Day', '劳动节'),
('2004-05-07', 'Labour Day', '劳动节'),
('2004-10-01', 'National Day', '国庆节'),
('2004-10-02', 'National Day', '国庆节'),
('2004-10-03', 'National Day', '国庆节'),
('2004-10-04', 'National Day', '国庆节'),
('2004-10-05', 'National Day', '国庆节'),
('2004-10-06', 'National Day', '国庆节'),
('2004-10-07', 'National Day', '国庆节'),
('2005-01-01', 'New Years Day', '元旦'),
('2005-01-02', 'New Years Day', '元旦'),
('2005-01-03', 'New Years Day', '元旦'),
('2005-02-09', 'Spring Festival', '春节'),
('2005-02-10', 'Spring Festival', '春节'),
('2005-02-11', 'Spring Festival', '春节'),
('2005-02-12', 'Spring Festival', '春节'),
('2005-02-13', 'Spring Festival', '春节'),
('2005-02-14', 'Spring Festival', '春节'),
('2005-02-15', 'Spring Festival', '春节'),
('2005-05-01', 'Labour Day', '劳动节'),
('2005-05-02', 'Labour Day', '劳动节'),
('2005-05-03', 'Labour Day', '劳动节'),
('2005-05-04', 'Labour Day', '劳动节'),
('2005-05-05', 'Labour Day', '劳动节'),
('2005-05-06', 'Labour Day', '劳动节'),
('2005-05-07', 'Labour Day', '劳动节'),
('2005-10-01', 'National Day', '国庆节'),
('2005-10-02', 'National Day', '国庆节'),
('2005-10-03', 'National Day', '国庆节'),
('2005-10-04', 'National Day', '国庆节'),
('2005-10-05', 'National Day', '国庆节'),
('2005-10-06', 'National Day', '国庆节'),
('2005-10-07', 'National Day', '国庆节'),
('2006-01-01', 'New Years Day', '元旦'),
('2006-01-02', 'New Years Day', '元旦'),
('2006-01-03', 'New Years Day', '元旦'),
('2006-01-29', 'Spring Festival', '春节'),
('2006-01-30', 'Spring Festival', '春节'),
('2006-01-31', 'Spring Festival', '春节'),
('2006-02-01', 'Spring Festival', '春节'),
('2006-02-02', 'Spring Festival', '春节'),
('2006-02-03', 'Spring Festival', '春节'),
('2006-02-04', 'Spring Festival', '春节'),
('2006-05-01', 'Labour Day', '劳动节'),
('2006-05-02', 'Labour Day', '劳动节'),
('2006-05-03', 'Labour Day', '劳动节'),
('2006-05-04', 'Labour Day', '劳动节'),
('2006-05-05', 'Labour Day', '劳动节'),
('2006-05-06', 'Labour Day', '劳动节'),
('2006-05-07', 'Labour Day', '劳动节'),
('2006-10-01', 'National Day', '国庆节'),
('2006-10-02', 'National Day', '国庆节'),
('2006-10-03', 'National Day', '国庆节'),
('2006-10-04', 'National Day', '国庆节'),
('2006-10-05', 'National Day', '国庆节'),
('2006-10-06', 'National Day', '国庆节'),
('2006-10-07', 'National Day', '国庆节'),
('2007-01-01', 'New Years Day', '元旦'),
('2007-01-02', 'New Years Day', '元旦'),
('2007-01-03', 'New Years Day', '元旦'),
('2007-02-18', 'Spring Festival', '春节'),
('2007-02-19', 'Spring Festival', '春节'),
('2007-02-20', 'Spring Festival', '春节'),
('2007-02-21', 'Spring Festival', '春节'),
('2007-02-22', 'Spring Festival', '春节'),
('2007-02-23', 'Spring Festival', '春节'),
('2007-02-24', 'Spring Festival', '春节'),
('2007-05-01', 'Labour Day', '劳动节'),
('2007-05-02', 'Labour Day', '劳动节'),
('2007-05-03', 'Labour Day', '劳动节'),
('2007-05-04', 'Labour Day', '劳动节'),
('2007-05-05', 'Labour Day', '劳动节'),
('2007-05-06', 'Labour Day', '劳动节'),
('2007-05-07', 'Labour Day', '劳动节'),
('2007-10-01', 'National Day', '国庆节'),
('2007-10-02', 'National Day', '国庆节'),
('2007-10-03', 'National Day', '国庆节'),
('2007-10-04', 'National Day', '国庆节'),
('2007-10-05', 'National Day', '国庆节'),
('2007-10-06', 'National Day', '国庆节'),
('2007-10-07', 'National Day', '国庆节'),
('2007-12-30', 'New Years Day', '元旦'),
('2007-12-31', 'New Years Day', '元旦'),
('2008-01-01', 'New Years Day', '元旦'),
('2008-02-06', 'Spring Festival', '春节'),
('2008-02-07', 'Spring Festival', '春节'),
('2008-02-08', 'Spring Festival', '春节'),
('2008-02-09', 'Spring Festival', '春节'),
('2008-02-10', 'Spring Festival', '春节'),
('2008-02-11', 'Spring Festival', '春节'),
('2008-02-12', 'Spring Festival', '春节'),
('2008-04-04', 'Tomb-sweeping Day', '清明'),
('2008-04-05', 'Tomb-sweeping Day', '清明'),
('2008-04-06', 'Tomb-sweeping Day', '清明'),
('2008-05-01', 'Labour Day', '劳动节'),
('2008-05-02', 'Labour Day', '劳动节'),
('2008-05-03', 'Labour Day', '劳动节'),
('2008-06-07', 'Dragon Boat Festival', '端午'),
('2008-06-08', 'Dragon Boat Festival', '端午'),
('2008-06-09', 'Dragon Boat Festival', '端午'),
('2008-09-13', 'Mid-autumn Festival', '中秋'),
('2008-09-14', 'Mid-autumn Festival', '中秋'),
('2008-09-15', 'Mid-autumn Festival', '中秋'),
('2008-09-29', 'National Day', '国庆节'),
('2008-09-30', 'National Day', '国庆节'),
('2008-10-01', 'National Day', '国庆节'),
('2008-10-02', 'National Day', '国庆节'),
('2008-10-03', 'National Day', '国庆节'),
('2008-10-04', 'National Day', '国庆节'),
('2008-10-05', 'National Day', '国庆节'),
('2009-01-01', 'New Years Day', '元旦'),
('2009-01-02', 'New Years Day', '元旦'),
('2009-01-03', 'New Years Day', '元旦'),
('2009-01-25', 'Spring Festival', '春节'),
('2009-01-26', 'Spring Festival', '春节'),
('2009-01-27', 'Spring Festival', '春节'),
('2009-01-28', 'Spring Festival', '春节'),
('2009-01-29', 'Spring Festival', '春节'),
('2009-01-30', 'Spring Festival', '春节'),
('2009-01-31', 'Spring Festival', '春节'),
('2009-04-04', 'Tomb-sweeping Day', '清明'),
('2009-04-05', 'Tomb-sweeping Day', '清明'),
('2009-04-06', 'Tomb-sweeping Day', '清明'),
('2009-05-01', 'Labour Day', '劳动节'),
('2009-05-02', 'Labour Day', '劳动节'),
('2009-05-03', 'Labour Day', '劳动节'),
('2009-05-28', 'Dragon Boat Festival', '端午'),
('2009-05-29', 'Dragon Boat Festival', '端午'),
('2009-05-30', 'Dragon Boat Festival', '端午'),
('2009-10-01', 'National Day', '国庆节'),
('2009-10-02', 'National Day', '国庆节'),
('2009-10-03', 'Mid-autumn Festival', '中秋'),
('2009-10-04', 'National Day', '国庆节'),
('2009-10-05', 'National Day', '国庆节'),
('2009-10-06', 'National Day', '国庆节'),
('2009-10-07', 'National Day', '国庆节'),
('2009-10-08', 'National Day', '国庆节'),
('2010-01-01', 'New Years Day', '元旦'),
('2010-01-02', 'New Years Day', '元旦'),
('2010-01-03', 'New Years Day', '元旦'),
('2010-02-13', 'Spring Festival', '春节'),
('2010-02-14', 'Spring Festival', '春节'),
('2010-02-15', 'Spring Festival', '春节'),
('2010-02-16', 'Spring Festival', '春节'),
('2010-02-17', 'Spring Festival', '春节'),
('2010-02-18', 'Spring Festival', '春节'),
('2010-02-19', 'Spring Festival', '春节'),
('2010-04-03', 'Tomb-sweeping Day', '清明'),
('2010-04-04', 'Tomb-sweeping Day', '清明'),
('2010-04-05', 'Tomb-sweeping Day', '清明'),
('2010-05-01', 'Labour Day', '劳动节'),
('2010-05-02', 'Labour Day', '劳动节'),
('2010-05-03', 'Labour Day', '劳动节'),
('2010-06-14', 'Dragon Boat Festival', '端午'),
('2010-06-15', 'Dragon Boat Festival', '端午'),
('2010-06-16', 'Dragon Boat Festival', '端午'),
('2010-09-22', 'Mid-autumn Festival', '中秋'),
('2010-09-23', 'Mid-autumn Festival', '中秋'),
('2010-09-24', 'Mid-autumn Festival', '中秋'),
('2010-10-01', 'National Day', '国庆节'),
('2010-10-02', 'National Day', '国庆节'),
('2010-10-03', 'National Day', '国庆节'),
('2010-10-04', 'National Day', '国庆节'),
('2010-10-05', 'National Day', '国庆节'),
('2010-10-06', 'National Day', '国庆节'),
('2010-10-07', 'National Day', '国庆节'),
('2011-01-01', 'New Years Day', '元旦'),
('2011-01-02', 'New Years Day', '元旦'),
('2011-01-03', 'New Years Day', '元旦'),
('2011-02-02', 'Spring Festival', '春节'),
('2011-02-03', 'Spring Festival', '春节'),
('2011-02-04', 'Spring Festival', '春节'),
('2011-02-05', 'Spring Festival', '春节'),
('2011-02-06', 'Spring Festival', '春节'),
('2011-02-07', 'Spring Festival', '春节'),
('2011-02-08', 'Spring Festival', '春节'),
('2011-04-03', 'Tomb-sweeping Day', '清明'),
('2011-04-04', 'Tomb-sweeping Day', '清明'),
('2011-04-05', 'Tomb-sweeping Day', '清明'),
('2011-04-30', 'Labour Day', '劳动节'),
('2011-05-01', 'Labour Day', '劳动节'),
('2011-05-02', 'Labour Day', '劳动节'),
('2011-06-04', 'Dragon Boat Festival', '端午'),
('2011-06-06', 'Dragon Boat Festival', '端午'),
('2011-09-10', 'Mid-autumn Festival', '中秋'),
('2011-09-11', 'Mid-autumn Festival', '中秋'),
('2011-09-12', 'Mid-autumn Festival', '中秋'),
('2011-10-01', 'National Day', '国庆节'),
('2011-10-02', 'National Day', '国庆节'),
('2011-10-03', 'National Day', '国庆节'),
('2011-10-04', 'National Day', '国庆节'),
('2011-10-05', 'National Day', '国庆节'),
('2011-10-06', 'National Day', '国庆节'),
('2011-10-07', 'National Day', '国庆节'),
('2012-01-01', 'New Years Day', '元旦'),
('2012-01-02', 'New Years Day', '元旦'),
('2012-01-03', 'New Years Day', '元旦'),
('2012-01-22', 'Spring Festival', '春节'),
('2012-01-23', 'Spring Festival', '春节'),
('2012-01-24', 'Spring Festival', '春节'),
('2012-01-25', 'Spring Festival', '春节'),
('2012-01-26', 'Spring Festival', '春节'),
('2012-01-27', 'Spring Festival', '春节'),
('2012-01-28', 'Spring Festival', '春节'),
('2012-04-02', 'Tomb-sweeping Day', '清明'),
('2012-04-03', 'Tomb-sweeping Day', '清明'),
('2012-04-04', 'Tomb-sweeping Day', '清明'),
('2012-04-29', 'Labour Day', '劳动节'),
('2012-04-30', 'Labour Day', '劳动节'),
('2012-05-01', 'Labour Day', '劳动节'),
('2012-06-22', 'Dragon Boat Festival', '端午'),
('2012-06-24', 'Dragon Boat Festival', '端午'),
('2012-09-30', 'Mid-autumn Festival', '中秋'),
('2012-10-01', 'National Day', '国庆节'),
('2012-10-02', 'National Day', '国庆节'),
('2012-10-03', 'National Day', '国庆节'),
('2012-10-04', 'National Day', '国庆节'),
('2012-10-05', 'National Day', '国庆节'),
('2012-10-06', 'National Day', '国庆节'),
('2012-10-07', 'National Day', '国庆节'),
('2013-01-01', 'New Years Day', '元旦'),
('2013-01-02', 'New Years Day', '元旦'),
('2013-01-03', 'New Years Day', '元旦'),
('2013-02-09', 'Spring Festival', '春节'),
('2013-02-10', 'Spring Festival', '春节'),
('2013-02-11', 'Spring Festival', '春节'),
('2013-02-12', 'Spring Festival', '春节'),
('2013-02-13', 'Spring Festival', '春节'),
('2013-02-14', 'Spring Festival', '春节'),
('2013-02-15', 'Spring Festival', '春节'),
('2013-04-04', 'Tomb-sweeping Day', '清明'),
('2013-04-05', 'Tomb-sweeping Day', '清明'),
('2013-04-06', 'Tomb-sweeping Day', '清明'),
('2013-04-29', 'Labour Day', '劳动节'),
('2013-04-30', 'Labour Day', '劳动节'),
('2013-05-01', 'Labour Day', '劳动节'),
('2013-06-10', 'Dragon Boat Festival', '端午'),
('2013-06-11', 'Dragon Boat Festival', '端午'),
('2013-06-12', 'Dragon Boat Festival', '端午'),
('2013-09-19', 'Mid-autumn Festival', '中秋'),
('2013-09-20', 'Mid-autumn Festival', '中秋'),
('2013-09-21', 'Mid-autumn Festival', '中秋'),
('2013-10-01', 'National Day', '国庆节'),
('2013-10-02', 'National Day', '国庆节'),
('2013-10-03', 'National Day', '国庆节'),
('2013-10-04', 'National Day', '国庆节'),
('2013-10-05', 'National Day', '国庆节'),
('2013-10-06', 'National Day', '国庆节'),
('2013-10-07', 'National Day', '国庆节'),
('2014-01-01', 'New Years Day', '元旦'),
('2014-01-31', 'Spring Festival', '春节'),
('2014-02-01', 'Spring Festival', '春节'),
('2014-02-02', 'Spring Festival', '春节'),
('2014-02-03', 'Spring Festival', '春节'),
('2014-02-04', 'Spring Festival', '春节'),
('2014-02-05', 'Spring Festival', '春节'),
('2014-02-06', 'Spring Festival', '春节'),
('2014-04-05', 'Tomb-sweeping Day', '清明'),
('2014-04-06', 'Tomb-sweeping Day', '清明'),
('2014-04-07', 'Tomb-sweeping Day', '清明'),
('2014-05-01', 'Labour Day', '劳动节'),
('2014-05-02', 'Labour Day', '劳动节'),
('2014-05-03', 'Labour Day', '劳动节'),
('2014-06-02', 'Dragon Boat Festival', '端午'),
('2014-09-08', 'Mid-autumn Festival', '中秋'),
('2014-10-01', 'National Day', '国庆节'),
('2014-10-02', 'National Day', '国庆节'),
('2014-10-03', 'National Day', '国庆节'),
('2014-10-04', 'National Day', '国庆节'),
('2014-10-05', 'National Day', '国庆节'),
('2014-10-06', 'National Day', '国庆节'),
('2014-10-07', 'National Day', '国庆节'),
('2015-01-01', 'New Years Day', '元旦'),
('2015-01-02', 'New Years Day', '元旦'),
('2015-01-03', 'New Years Day', '元旦'),
('2015-02-18', 'Spring Festival', '春节'),
('2015-02-19', 'Spring Festival', '春节'),
('2015-02-20', 'Spring Festival', '春节'),
('2015-02-21', 'Spring Festival', '春节'),
('2015-02-22', 'Spring Festival', '春节'),
('2015-02-23', 'Spring Festival', '春节'),
('2015-02-24', 'Spring Festival', '春节'),
('2015-04-05', 'Tomb-sweeping Day', '清明'),
('2015-04-06', 'Tomb-sweeping Day', '清明'),
('2015-05-01', 'Labour Day', '劳动节'),
('2015-06-20', 'Dragon Boat Festival', '端午'),
('2015-06-22', 'Dragon Boat Festival', '端午'),
('2015-09-27', 'Mid-autumn Festival', '中秋'),
('2015-10-01', 'National Day', '国庆节'),
('2015-10-02', 'National Day', '国庆节'),
('2015-10-03', 'National Day', '国庆节'),
('2015-10-04', 'National Day', '国庆节'),
('2015-10-05', 'National Day', '国庆节'),
('2015-10-06', 'National Day', '国庆节'),
('2015-10-07', 'National Day', '国庆节'),
('2016-01-01', 'New Years Day', '元旦'),
('2016-02-07', 'Spring Festival', '春节'),
('2016-02-08', 'Spring Festival', '春节'),
('2016-02-09', 'Spring Festival', '春节'),
('2016-02-10', 'Spring Festival', '春节'),
('2016-02-11', 'Spring Festival', '春节'),
('2016-02-12', 'Spring Festival', '春节'),
('2016-02-13', 'Spring Festival', '春节'),
('2016-04-04', 'Tomb-sweeping Day', '清明'),
('2016-05-01', 'Labour Day', '劳动节'),
('2016-05-02', 'Labour Day', '劳动节'),
('2016-06-09', 'Dragon Boat Festival', '端午'),
('2016-06-10', 'Dragon Boat Festival', '端午'),
('2016-06-11', 'Dragon Boat Festival', '端午'),
('2016-09-15', 'Mid-autumn Festival', '中秋'),
('2016-09-16', 'Mid-autumn Festival', '中秋'),
('2016-09-17', 'Mid-autumn Festival', '中秋'),
('2016-10-01', 'National Day', '国庆节'),
('2016-10-02', 'National Day', '国庆节'),
('2016-10-03', 'National Day', '国庆节'),
('2016-10-04', 'National Day', '国庆节'),
('2016-10-05', 'National Day', '国庆节'),
('2016-10-06', 'National Day', '国庆节'),
('2016-10-07', 'National Day', '国庆节'),
('2017-01-01', 'New Years Day', '元旦'),
('2017-01-02', 'New Years Day', '元旦'),
('2017-01-27', 'Spring Festival', '春节'),
('2017-01-28', 'Spring Festival', '春节'),
('2017-01-29', 'Spring Festival', '春节'),
('2017-01-30', 'Spring Festival', '春节'),
('2017-01-31', 'Spring Festival', '春节'),
('2017-02-01', 'Spring Festival', '春节'),
('2017-02-02', 'Spring Festival', '春节'),
('2017-04-02', 'Tomb-sweeping Day', '清明'),
('2017-04-03', 'Tomb-sweeping Day', '清明'),
('2017-04-04', 'Tomb-sweeping Day', '清明'),
('2017-05-01', 'Labour Day', '劳动节'),
('2017-05-28', 'Dragon Boat Festival', '端午'),
('2017-05-29', 'Dragon Boat Festival', '端午'),
('2017-05-30', 'Dragon Boat Festival', '端午'),
('2017-10-01', 'National Day', '国庆节'),
('2017-10-02', 'National Day', '国庆节'),
('2017-10-03', 'National Day', '国庆节'),
('2017-10-04', 'Mid-autumn Festival', '中秋'),
('2017-10-05', 'National Day', '国庆节'),
('2017-10-06', 'National Day', '国庆节'),
('2017-10-07', 'National Day', '国庆节'),
('2017-10-08', 'National Day', '国庆节'),
('2018-01-01', 'New Years Day', '元旦'),
('2018-02-15', 'Spring Festival', '春节'),
('2018-02-16', 'Spring Festival', '春节'),
('2018-02-17', 'Spring Festival', '春节'),
('2018-02-18', 'Spring Festival', '春节'),
('2018-02-19', 'Spring Festival', '春节'),
('2018-02-20', 'Spring Festival', '春节'),
('2018-02-21', 'Spring Festival', '春节'),
('2018-04-05', 'Tomb-sweeping Day', '清明'),
('2018-04-06', 'Tomb-sweeping Day', '清明'),
('2018-04-07', 'Tomb-sweeping Day', '清明'),
('2018-04-29', 'Labour Day', '劳动节'),
('2018-04-30', 'Labour Day', '劳动节'),
('2018-05-01', 'Labour Day', '劳动节'),
('2018-06-18', 'Dragon Boat Festival', '端午'),
('2018-09-24', 'Mid-autumn Festival', '中秋'),
('2018-10-01', 'National Day', '国庆节'),
('2018-10-02', 'National Day', '国庆节'),
('2018-10-03', 'National Day', '国庆节'),
('2018-10-04', 'National Day', '国庆节'),
('2018-10-05', 'National Day', '国庆节'),
('2018-10-06', 'National Day', '国庆节'),
('2018-10-07', 'National Day', '国庆节'),
('2018-12-30', 'New Years Day', '元旦'),
('2018-12-31', 'New Years Day', '元旦'),
('2019-01-01', 'New Years Day', '元旦'),
('2019-02-04', 'Spring Festival', '春节'),
('2019-02-05', 'Spring Festival', '春节'),
('2019-02-06', 'Spring Festival', '春节'),
('2019-02-07', 'Spring Festival', '春节'),
('2019-02-08', 'Spring Festival', '春节'),
('2019-02-09', 'Spring Festival', '春节'),
('2019-02-10', 'Spring Festival', '春节'),
('2019-04-05', 'Tomb-sweeping Day', '清明'),
('2019-04-06', 'Tomb-sweeping Day', '清明'),
('2019-04-07', 'Tomb-sweeping Day', '清明'),
('2019-05-01', 'Labour Day', '劳动节'),
('2019-05-02', 'Labour Day', '劳动节'),
('2019-05-03', 'Labour Day', '劳动节'),
('2019-05-04', 'Labour Day', '劳动节'),
('2019-06-07', 'Dragon Boat Festival', '端午'),
('2019-06-08', 'Dragon Boat Festival', '端午'),
('2019-06-09', 'Dragon Boat Festival', '端午'),
('2019-09-13', 'Mid-autumn Festival', '中秋'),
('2019-09-14', 'Mid-autumn Festival', '中秋'),
('2019-09-15', 'Mid-autumn Festival', '中秋'),
('2019-10-01', 'National Day', '国庆节'),
('2019-10-02', 'National Day', '国庆节'),
('2019-10-03', 'National Day', '国庆节'),
('2019-10-04', 'National Day', '国庆节'),
('2019-10-05', 'National Day', '国庆节'),
('2019-10-06', 'National Day', '国庆节'),
('2019-10-07', 'National Day', '国庆节'),
('2020-01-01', 'New Years Day', '元旦'),
('2020-01-24', 'Spring Festival', '春节'),
('2020-01-25', 'Spring Festival', '春节'),
('2020-01-26', 'Spring Festival', '春节'),
('2020-01-27', 'Spring Festival', '春节'),
('2020-01-28', 'Spring Festival', '春节'),
('2020-01-29', 'Spring Festival', '春节'),
('2020-01-30', 'Spring Festival', '春节'),
('2020-01-31', 'Spring Festival', '春节'),
('2020-02-01', 'Spring Festival', '春节'),
('2020-02-02', 'Spring Festival', '春节'),
('2020-04-04', 'Tomb-sweeping Day', '清明'),
('2020-04-05', 'Tomb-sweeping Day', '清明'),
('2020-04-06', 'Tomb-sweeping Day', '清明'),
('2020-05-01', 'Labour Day', '劳动节'),
('2020-05-02', 'Labour Day', '劳动节'),
('2020-05-03', 'Labour Day', '劳动节'),
('2020-05-04', 'Labour Day', '劳动节'),
('2020-05-05', 'Labour Day', '劳动节'),
('2020-06-25', 'Dragon Boat Festival', '端午'),
('2020-06-26', 'Dragon Boat Festival', '端午'),
('2020-06-27', 'Dragon Boat Festival', '端午'),
('2020-10-01', 'National Day', '国庆节'),
('2020-10-02', 'National Day', '国庆节'),
('2020-10-03', 'National Day', '国庆节'),
('2020-10-04', 'National Day', '国庆节'),
('2020-10-05', 'National Day', '国庆节'),
('2020-10-06', 'National Day', '国庆节'),
('2020-10-07', 'National Day', '国庆节'),
('2020-10-08', 'National Day', '国庆节'),
('2021-01-01', 'New Years Day', '元旦'),
('2021-01-02', 'New Years Day', '元旦'),
('2021-01-03', 'New Years Day', '元旦'),
('2021-02-11', 'Spring Festival', '春节'),
('2021-02-12', 'Spring Festival', '春节'),
('2021-02-13', 'Spring Festival', '春节'),
('2021-02-14', 'Spring Festival', '春节'),
('2021-02-15', 'Spring Festival', '春节'),
('2021-02-16', 'Spring Festival', '春节'),
('2021-02-17', 'Spring Festival', '春节'),
('2021-04-03', 'Tomb-sweeping Day', '清明'),
('2021-04-04', 'Tomb-sweeping Day', '清明'),
('2021-04-05', 'Tomb-sweeping Day', '清明'),
('2021-05-01', 'Labour Day', '劳动节'),
('2021-05-02', 'Labour Day', '劳动节'),
('2021-05-03', 'Labour Day', '劳动节'),
('2021-05-04', 'Labour Day', '劳动节'),
('2021-05-05', 'Labour Day', '劳动节'),
('2021-06-12', 'Dragon Boat Festival', '端午'),
('2021-06-13', 'Dragon Boat Festival', '端午'),
('2021-06-14', 'Dragon Boat Festival', '端午'),
('2021-09-19', 'Mid-autumn Festival', '中秋'),
('2021-09-20', 'Mid-autumn Festival', '中秋'),
('2021-09-21', 'Mid-autumn Festival', '中秋'),
('2021-10-01', 'National Day', '国庆节'),
('2021-10-02', 'National Day', '国庆节'),
('2021-10-03', 'National Day', '国庆节'),
('2021-10-04', 'National Day', '国庆节'),
('2021-10-05', 'National Day', '国庆节'),
('2021-10-06', 'National Day', '国庆节'),
('2021-10-07', 'National Day', '国庆节'),
('2022-01-01', 'New Years Day', '元旦'),
('2022-01-02', 'New Years Day', '元旦'),
('2022-01-03', 'New Years Day', '元旦'),
('2022-01-31', 'Spring Festival', '春节'),
('2022-02-01', 'Spring Festival', '春节'),
('2022-02-02', 'Spring Festival', '春节'),
('2022-02-03', 'Spring Festival', '春节'),
('2022-02-04', 'Spring Festival', '春节'),
('2022-02-05', 'Spring Festival', '春节'),
('2022-02-06', 'Spring Festival', '春节'),
('2022-04-03', 'Tomb-sweeping Day', '清明'),
('2022-04-04', 'Tomb-sweeping Day', '清明'),
('2022-04-05', 'Tomb-sweeping Day', '清明'),
('2022-04-30', 'Labour Day', '劳动节'),
('2022-05-01', 'Labour Day', '劳动节'),
('2022-05-02', 'Labour Day', '劳动节'),
('2022-05-03', 'Labour Day', '劳动节'),
('2022-05-04', 'Labour Day', '劳动节'),
('2022-06-03', 'Dragon Boat Festival', '端午'),
('2022-06-04', 'Dragon Boat Festival', '端午'),
('2022-06-05', 'Dragon Boat Festival', '端午'),
('2022-09-10', 'Mid-autumn Festival', '中秋'),
('2022-09-11', 'Mid-autumn Festival', '中秋'),
('2022-09-12', 'Mid-autumn Festival', '中秋'),
('2022-10-01', 'National Day', '国庆节'),
('2022-10-02', 'National Day', '国庆节'),
('2022-10-03', 'National Day', '国庆节'),
('2022-10-04', 'National Day', '国庆节'),
('2022-10-05', 'National Day', '国庆节'),
('2022-10-06', 'National Day', '国庆节'),
('2022-10-07', 'National Day', '国庆节'),
('2022-12-31', 'New Years Day', '元旦'),
('2023-01-01', 'New Years Day', '元旦'),
('2023-01-02', 'New Years Day', '元旦'),
('2023-01-21', 'Spring Festival', '春节'),
('2023-01-22', 'Spring Festival', '春节'),
('2023-01-23', 'Spring Festival', '春节'),
('2023-01-24', 'Spring Festival', '春节'),
('2023-01-25', 'Spring Festival', '春节'),
('2023-01-26', 'Spring Festival', '春节'),
('2023-01-27', 'Spring Festival', '春节'),
('2023-04-05', 'Tomb-sweeping Day', '清明'),
('2023-04-29', 'Labour Day', '劳动节'),
('2023-04-30', 'Labour Day', '劳动节'),
('2023-05-01', 'Labour Day', '劳动节'),
('2023-05-02', 'Labour Day', '劳动节'),
('2023-05-03', 'Labour Day', '劳动节'),
('2023-06-22', 'Dragon Boat Festival', '端午'),
('2023-06-23', 'Dragon Boat Festival', '端午'),
('2023-06-24', 'Dragon Boat Festival', '端午'),
('2023-09-29', 'Mid-autumn Festival', '中秋'),
('2023-09-30', 'National Day', '国庆节'),
('2023-10-01', 'National Day', '国庆节'),
('2023-10-02', 'National Day', '国庆节'),
('2023-10-03', 'National Day', '国庆节'),
('2023-10-04', 'National Day', '国庆节'),
('2023-10-05', 'National Day', '国庆节'),
('2023-10-06', 'National Day', '国庆节'),
('2024-01-01', 'New Years Day', '元旦'),
('2024-02-10', 'Spring Festival', '春节'),
('2024-02-11', 'Spring Festival', '春节'),
('2024-02-12', 'Spring Festival', '春节'),
('2024-02-13', 'Spring Festival', '春节'),
('2024-02-14', 'Spring Festival', '春节'),
('2024-02-15', 'Spring Festival', '春节'),
('2024-02-16', 'Spring Festival', '春节'),
('2024-02-17', 'Spring Festival', '春节'),
('2024-04-04', 'Tomb-sweeping Day', '清明'),
('2024-04-05', 'Tomb-sweeping Day', '清明'),
('2024-04-06', 'Tomb-sweeping Day', '清明'),
('2024-05-01', 'Labour Day', '劳动节'),
('2024-05-02', 'Labour Day', '劳动节'),
('2024-05-03', 'Labour Day', '劳动节'),
('2024-05-04', 'Labour Day', '劳动节'),
('2024-05-05', 'Labour Day', '劳动节'),
('2024-06-10', 'Dragon Boat Festival', '端午'),
('2024-09-15', 'Mid-autumn Festival', '中秋'),
('2024-09-16', 'Mid-autumn Festival', '中秋'),
('2024-09-17', 'Mid-autumn Festival', '中秋'),
('2024-10-01', 'National Day', '国庆节'),
('2024-10-02', 'National Day', '国庆节'),
('2024-10-03', 'National Day', '国庆节'),
('2024-10-04', 'National Day', '国庆节'),
('2024-10-05', 'National Day', '国庆节'),
('2024-10-06', 'National Day', '国庆节'),
('2024-10-07', 'National Day', '国庆节');

调休日sql数据

调休日表【weekdays】创建语句:

CREATE TABLE `workdays` (
  `workday` varchar(100) NOT NULL,
  `english_name` varchar(100) NOT NULL,
  `chinese_name` varchar(100) NOT NULL,
  PRIMARY KEY (`workday`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

调休日sql语句:文章来源地址https://www.toymoban.com/news/detail-804775.html

insert into workdays(workday,english_name,chinese_name) values ('2004-01-17', 'Spring Festival', '春节'),
('2004-01-18', 'Spring Festival', '春节'),
('2004-05-08', 'Labour Day', '劳动节'),
('2004-05-09', 'Labour Day', '劳动节'),
('2004-10-09', 'National Day', '国庆节'),
('2004-10-10', 'National Day', '国庆节'),
('2005-02-05', 'Spring Festival', '春节'),
('2005-02-06', 'Spring Festival', '春节'),
('2005-04-30', 'Labour Day', '劳动节'),
('2005-05-08', 'Labour Day', '劳动节'),
('2005-10-08', 'National Day', '国庆节'),
('2005-10-09', 'National Day', '国庆节'),
('2006-01-28', 'Spring Festival', '春节'),
('2006-02-05', 'Spring Festival', '春节'),
('2006-04-29', 'Labour Day', '劳动节'),
('2006-04-30', 'Labour Day', '劳动节'),
('2006-09-30', 'National Day', '国庆节'),
('2006-10-08', 'National Day', '国庆节'),
('2006-12-30', 'New Years Day', '元旦'),
('2006-12-31', 'New Years Day', '元旦'),
('2007-02-17', 'Spring Festival', '春节'),
('2007-02-25', 'Spring Festival', '春节'),
('2007-04-28', 'Labour Day', '劳动节'),
('2007-04-29', 'Labour Day', '劳动节'),
('2007-09-29', 'National Day', '国庆节'),
('2007-09-30', 'National Day', '国庆节'),
('2007-12-29', 'New Years Day', '元旦'),
('2008-02-02', 'Spring Festival', '春节'),
('2008-02-03', 'Spring Festival', '春节'),
('2008-05-04', 'Labour Day', '劳动节'),
('2008-09-27', 'National Day', '国庆节'),
('2008-09-28', 'National Day', '国庆节'),
('2009-01-04', 'New Years Day', '元旦'),
('2009-01-24', 'Spring Festival', '春节'),
('2009-02-01', 'Spring Festival', '春节'),
('2009-05-31', 'Dragon Boat Festival', '端午'),
('2009-09-27', 'National Day', '国庆节'),
('2009-10-10', 'National Day', '国庆节'),
('2010-02-20', 'Spring Festival', '春节'),
('2010-02-21', 'Spring Festival', '春节'),
('2010-06-12', 'Dragon Boat Festival', '端午'),
('2010-06-13', 'Dragon Boat Festival', '端午'),
('2010-09-19', 'Mid-autumn Festival', '中秋'),
('2010-09-25', 'Mid-autumn Festival', '中秋'),
('2010-09-26', 'National Day', '国庆节'),
('2010-10-09', 'National Day', '国庆节'),
('2011-01-30', 'Spring Festival', '春节'),
('2011-02-12', 'Spring Festival', '春节'),
('2011-04-02', 'Tomb-sweeping Day', '清明'),
('2011-10-08', 'National Day', '国庆节'),
('2011-10-09', 'National Day', '国庆节'),
('2011-12-31', 'New Years Day', '元旦'),
('2012-01-21', 'Spring Festival', '春节'),
('2012-01-29', 'Spring Festival', '春节'),
('2012-03-31', 'Tomb-sweeping Day', '清明'),
('2012-04-01', 'Tomb-sweeping Day', '清明'),
('2012-04-28', 'Labour Day', '劳动节'),
('2012-09-29', 'National Day', '国庆节'),
('2013-01-05', 'New Years Day', '元旦'),
('2013-01-06', 'New Years Day', '元旦'),
('2013-02-16', 'Spring Festival', '春节'),
('2013-02-17', 'Spring Festival', '春节'),
('2013-04-07', 'Tomb-sweeping Day', '清明'),
('2013-04-27', 'Labour Day', '劳动节'),
('2013-04-28', 'Labour Day', '劳动节'),
('2013-06-08', 'Dragon Boat Festival', '端午'),
('2013-06-09', 'Dragon Boat Festival', '端午'),
('2013-09-22', 'Mid-autumn Festival', '中秋'),
('2013-09-29', 'National Day', '国庆节'),
('2013-10-12', 'National Day', '国庆节'),
('2014-01-26', 'Spring Festival', '春节'),
('2014-02-08', 'Spring Festival', '春节'),
('2014-05-04', 'Labour Day', '劳动节'),
('2014-09-28', 'National Day', '国庆节'),
('2014-10-11', 'National Day', '国庆节'),
('2015-01-04', 'New Years Day', '元旦'),
('2015-02-15', 'Spring Festival', '春节'),
('2015-02-28', 'Spring Festival', '春节'),
('2015-10-10', 'National Day', '国庆节'),
('2016-02-06', 'Spring Festival', '春节'),
('2016-02-14', 'Spring Festival', '春节'),
('2016-06-12', 'Dragon Boat Festival', '端午'),
('2016-09-18', 'Mid-autumn Festival', '中秋'),
('2016-10-08', 'National Day', '国庆节'),
('2016-10-09', 'National Day', '国庆节'),
('2017-01-22', 'Spring Festival', '春节'),
('2017-02-04', 'Spring Festival', '春节'),
('2017-04-01', 'Tomb-sweeping Day', '清明'),
('2017-05-27', 'Dragon Boat Festival', '端午'),
('2017-09-30', 'National Day', '国庆节'),
('2018-02-11', 'Spring Festival', '春节'),
('2018-02-24', 'Spring Festival', '春节'),
('2018-04-08', 'Tomb-sweeping Day', '清明'),
('2018-04-28', 'Labour Day', '劳动节'),
('2018-09-29', 'National Day', '国庆节'),
('2018-09-30', 'National Day', '国庆节'),
('2018-12-29', 'New Years Day', '元旦'),
('2019-02-02', 'Spring Festival', '春节'),
('2019-02-03', 'Spring Festival', '春节'),
('2019-04-28', 'Labour Day', '劳动节'),
('2019-05-05', 'Labour Day', '劳动节'),
('2019-09-29', 'National Day', '国庆节'),
('2019-10-12', 'National Day', '国庆节'),
('2020-01-19', 'Spring Festival', '春节'),
('2020-04-26', 'Labour Day', '劳动节'),
('2020-05-09', 'Labour Day', '劳动节'),
('2020-06-28', 'Dragon Boat Festival', '端午'),
('2020-09-27', 'National Day', '国庆节'),
('2020-10-10', 'National Day', '国庆节'),
('2021-02-07', 'Spring Festival', '春节'),
('2021-02-20', 'Spring Festival', '春节'),
('2021-04-25', 'Labour Day', '劳动节'),
('2021-05-08', 'Labour Day', '劳动节'),
('2021-09-18', 'Mid-autumn Festival', '中秋'),
('2021-09-26', 'National Day', '国庆节'),
('2021-10-09', 'National Day', '国庆节'),
('2022-01-29', 'Spring Festival', '春节'),
('2022-01-30', 'Spring Festival', '春节'),
('2022-04-02', 'Tomb-sweeping Day', '清明'),
('2022-04-24', 'Labour Day', '劳动节'),
('2022-05-07', 'Labour Day', '劳动节'),
('2022-10-08', 'National Day', '国庆节'),
('2022-10-09', 'National Day', '国庆节'),
('2023-01-28', 'Spring Festival', '春节'),
('2023-01-29', 'Spring Festival', '春节'),
('2023-04-23', 'Labour Day', '劳动节'),
('2023-05-06', 'Labour Day', '劳动节'),
('2023-06-25', 'Dragon Boat Festival', '端午'),
('2023-10-07', 'National Day', '国庆节'),
('2023-10-08', 'National Day', '国庆节'),
('2024-02-04', 'Spring Festival', '春节'),
('2024-02-18', 'Spring Festival', '春节'),
('2024-04-07', 'Tomb-sweeping Day', '清明'),
('2024-04-28', 'Labour Day', '劳动节'),
('2024-05-11', 'Labour Day', '劳动节'),
('2024-09-14', 'Mid-autumn Festival', '中秋'),
('2024-09-29', 'National Day', '国庆节'),
('2024-10-12', 'National Day', '国庆节');

到了这里,关于用Python判断节假日,以及节假日的SQL数据文件的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • java获取国家法定节假日(不依赖API)

    java获取国家法定节假日, 由此可获取每月第一个工作日和最后一个工作日 (不依赖API,主要是因为API接口不可靠或计费,此工具依赖国务院发布的节假日基础信息进行解析) 本工具仅供参考学习。 各类数据获取需遵守法律法规

    2024年02月09日
    浏览(34)
  • 基于Anylogic仿真系统的节假日城市轨道交通大客流优化—以春熙路地铁站为例

    目 录 1绪论 1 1.1研究背景与意义 1 1.2国内外研究现状 1 1.2.1国外研究现状 1 1.2.2国内研究现状 2 1.3研究内容 2 2春熙路地铁站交通特性分析 4 2.1车站布局分析 4 2.1.1春熙路站概况 4 2.1.2站厅层设施布局分析 4 2.1.3站台层设施布局分析 5 2.2车站运营流程分析 6 2.2.1乘客进出站流程 6

    2024年02月02日
    浏览(44)
  • python 导入同级目录文件、上级目录文件以及下级目录数据集和模块包

    一. python import 上级目录: 1.1 第一种方法: 有时候我们可能需要import另一个路径下的python文件,例如下面这个目录结构,我们想要在_train.py里import在networks目录下的_lstm.py和上级目录下的_config.py。 只需两步操作 : 1. 在networks文件夹下创建空的__init__.py文件 2. 使用sys库添加路径

    2024年02月12日
    浏览(44)
  • sql update执行返回0,能否判断数据不存在

    答案:不能。 1、没有找到需要更新的数据,就是这条记录不存在 例如:where后面的条件是id=0,那这条记录肯定是不存在的,返回结果是0 2、更新时的数据和要更新的数据完全一致时 例如:更新前的数据name=张三,我们使用update将name还是改为张三,这里返回的结果依然是0

    2024年02月12日
    浏览(43)
  • js常用判断数据类型方法以及优缺点 以及 instanceof 原理实现

    使用typeof操作符可以 判断一个值的数据类型 。它返回一个表示数据类型的字符串。 优点:typeof 操作符是一种简单、快速的方式来 判断基本数据类型 。它返回的结果是一个字符串,可以直接用于条件判断。 缺点: 对于引用类型(除了函数)的判断结果都是\\\'object\\\' ,无法细

    2024年02月12日
    浏览(45)
  • SQL Server判断数据库、表、列、视图、存储过程、函数是否存在

    在写一些业务逻辑相对复杂点的存储过程的时候,经常会用到临时表或者数据表作为临时结果的保存。但每次在作表是否存在的判断时,往往想不起完整的SQL写法。因此,记录一些常用的数据库对象是否存在的判断方法,可以达到快速查找的目的。正是:好记性不如烂笔头。

    2024年02月02日
    浏览(128)
  • SQL Server数据库判断最近一次的备份执行结果

    在SQL Server的官方文档里面可以看到备份和还原的表,但是这些表里面只能找到备份成功的相关信息,无法找到备份失败的记录,比如 msdb.dbo.backupset 。对于一些监控系统未监控作业的情况下,想要监控数据库备份任务执行失败而触发告警规则,有些麻烦。 但是SQL server内部是

    2024年02月03日
    浏览(85)
  • 一篇文章打好SQL基础,熟悉数据库的基础操作和方法,以及安装MySQL软件包和Python操作MySQL基础使用

    SQL的全称:Structured Query Language,结构化查询语言,用于 访问和处理数据库的标准计算机语言 。 SQL语言1974年有Boyce和Chamberlin提出的,并且首先在IBM公司研制的关系数据库系统SystemR上实现。 经过多年发展,SQL已经成为数据库领域同意的数据操作标准语言,可以说几乎市面上所

    2024年02月08日
    浏览(81)
  • 【Python】判断素数的三种方法以及for-else语句的介绍

      输入一个数,如果是素数就输出\\\"Yes\\\",否则输出\\\"No\\\" 自定义函数 is_prime() ,首先排除1,然后再对该数之前的数进行枚举,当遇到能被当前的数整除时返回False,若没有数能将其整除意味着这个数是素数,返回True。然后对返回的结果进行判断从而输出\\\"Yes\\\"或\\\"No\\\" 当然,我们可以

    2024年02月04日
    浏览(41)
  • python判断文件或文件夹是否存在、创建文件夹

    以下的内容参考http://t.csdn.cn/aybFd,https://www.cnblogs.com/hushaojun/p/4533241.html python判断文件或文件夹是否存在、创建文件夹 1、判断文件或文件夹是否存在 2、判断所给路径是文件还是文件夹 3、创建文件夹 4、获取当前.py文件的路径 5、获取指定目录下所有的文件和文件夹 删除一个

    2024年02月10日
    浏览(75)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包