The Teachers' Day

博主来自越南,11月20日是越南教师节,这天学生们会向老师表达感激。博主回忆高中一位老师,周五不上课,会讲世界历史故事、展示特别收藏和表演魔术,其教学方式让学生既开心又能学习。
Hello everyone! I'm from Viet Nam, 20th nov is on coming, in my country thiis the Teaher's day, on this day we show our graitude to our teacher by many actions, I would love to hear your story about the teachers whom u love best, please tell me.

===
During Teacher's Day we students usually do something special to our beloved teachers. We give them some gifts or we conduct some programs to cheer them up.

I remember this one teacher of mine in high school. Friday is considered our off day. He doesn't conduct his class lessons. What he usually do is that he tells us amazing stories related to world history, shows his unusual collections and performs some magic acts. All of us are looking forward to what is going to happen every Fridays.

With his style of teaching, we never get bored. We are having fun and we are also learning at the same time.
### SQL 计算每个学生从出生日期起的年龄 在不同数据库中计算年龄的方式略有不同,以下以 MySQL 和 SQL Server 为例: #### MySQL ```sql SELECT student_id, TIMESTAMPDIFF(YEAR, birth_date, CURDATE()) AS age FROM students; ``` #### SQL Server ```sql SELECT student_id, DATEDIFF(YEAR, birth_date, GETDATE()) - CASE WHEN MONTH(birth_date) > MONTH(GETDATE()) OR (MONTH(birth_date) = MONTH(GETDATE()) AND DAY(birth_date) > DAY(GETDATE())) THEN 1 ELSE 0 END AS age FROM students; ``` ### SQL 计算从今天到每个课程结束的天数 #### MySQL ```sql SELECT course_id, DATEDIFF(end_date, CURDATE()) AS remaining_days FROM courses; ``` #### SQL Server ```sql SELECT course_id, DATEDIFF(DAY, GETDATE(), end_date) AS remaining_days FROM courses; ``` ### SQL 提取所有学生的入学年份 #### MySQL ```sql SELECT student_id, YEAR(enrollment_date) AS enrollment_year FROM students; ``` #### SQL Server ```sql SELECT student_id, YEAR(enrollment_date) AS enrollment_year FROM students; ``` ### SQL 为课程开始日期增加 30 天用于迎新期 #### MySQL ```sql SELECT course_id, DATE_ADD(start_date, INTERVAL 30 DAY) AS new_start_date FROM courses; ``` #### SQL Server ```sql SELECT course_id, DATEADD(DAY, 30, start_date) AS new_start_date FROM courses; ``` ### SQL 查找所有课程开始日期是星期几 #### MySQL ```sql SELECT course_id, DAYNAME(start_date) AS day_of_week FROM courses; ``` #### SQL Server ```sql SELECT course_id, DATENAME(WEEKDAY, start_date) AS day_of_week FROM courses; ``` ### SQL 计算入学日期和今天之间的月差 #### MySQL ```sql SELECT student_id, TIMESTAMPDIFF(MONTH, enrollment_date, CURDATE()) AS month_difference FROM students; ``` #### SQL Server ```sql SELECT student_id, DATEDIFF(MONTH, enrollment_date, GETDATE()) AS month_difference FROM students; ``` ### SQL 将所有日期格式化为 'DD - MM - YYYY' #### MySQL ```sql SELECT student_id, DATE_FORMAT(birth_date, '%d - %m - %Y') AS formatted_birth_date FROM students; ``` #### SQL Server ```sql SELECT student_id, FORMAT(birth_date, 'dd - MM - yyyy') AS formatted_birth_date FROM students; ``` ### SQL 查找课程开始日期所在月的最后一天 #### MySQL ```sql SELECT course_id, LAST_DAY(start_date) AS last_day_of_month FROM courses; ``` #### SQL Server ```sql SELECT course_id, DATEADD(DAY, -1, DATEADD(MONTH, DATEDIFF(MONTH, 0, start_date) + 1, 0)) AS last_day_of_month FROM courses; ``` ### SQL 提取教师聘用日期所在的季度 #### MySQL ```sql SELECT teacher_id, QUARTER(hire_date) AS hire_quarter FROM teachers; ``` #### SQL Server ```sql SELECT teacher_id, DATEPART(QUARTER, hire_date) AS hire_quarter FROM teachers; ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值