zoukankan      html  css  js  c++  java
  • 12306-票

    ylbtech-dbs:12306-票

     

    A,数据库关系图(Database Diagram) 返回顶部
    B,数据库设计脚本(Database Design Script)返回顶部

    3,查询余票

    2,查询车次

    --1/2,出发站和目的站在同一次列车时间表上
    --2/2,起始站序<目的站序

    2.2,

    --2,查询车次,假设:菏泽-->曹县
    --菏泽-->曹县
    select tn.trainNumberCode,tn.trainNumberType
    ,tn.departureStationId,(select Station from Station where stationId=tn.departureStationId)'departureStation'
    ,tn.destinationStationId,(select Station from Station where stationId=tn.destinationStationId)'destinationStation'
    ,tn.departureTime,tn.destinationTime from TrainNumber tn 
    where tn.trainNumberId in(
    select t.trainNumberId from Timetable t
    inner join Timetable t2 on t.trainNumberId=t2.trainNumberId
    where t.sortCode<t2.sortCode
    and t.stationId=(select stationId from Station where station='菏泽')
    and t2.stationId=(select stationId from Station where station='曹县'))
    View Code

    2.1,

    --2,查询车次,假设:菏泽-->曹县
    --菏泽-->曹县
    select * from TrainNumber tn where tn.trainNumberId in(
    select t.trainNumberId from Timetable t
    inner join Timetable t2 on t.trainNumberId=t2.trainNumberId
    where t.sortCode<t2.sortCode
    and t.stationId=(select stationId from Station where station='菏泽')
    and t2.stationId=(select stationId from Station where station='曹县'))
    
    select * from TrainNumber tn where tn.trainNumberId in(
    select t.trainNumberId from Timetable t
    inner join Timetable t2 on t.trainNumberId=t2.trainNumberId
    where t.sortCode<t2.sortCode
    and t.stationId=(select stationId from Station where station='菏泽')
    and t2.stationId=(select stationId from Station where station='定陶'))
    
    select * from TrainNumber tn where tn.trainNumberId in(
    select t.trainNumberId from Timetable t
    inner join Timetable t2 on t.trainNumberId=t2.trainNumberId
    where t.sortCode<t2.sortCode
    and t.stationId=(select stationId from Station where station='定陶')
    and t2.stationId=(select stationId from Station where station='曹县'))
    
    --曹县-->菏泽
    select * from TrainNumber tn where tn.trainNumberId in(
    select t.trainNumberId from Timetable t
    inner join Timetable t2 on t.trainNumberId=t2.trainNumberId
    where t.sortCode<t2.sortCode
    and t.stationId=(select stationId from Station where station='曹县')
    and t2.stationId=(select stationId from Station where station='菏泽'))
    View Code

    1,查询列车时刻表

    1.1,

    use TrainTicket
    go
    
    go
    --1,Z01列次时刻表
    select t.[type],t.sortCode'站序',s.station'站名',CONVERT(varchar(8),t.departureTime,108)'到时',t.destinationTime'发时' from Timetable t
    inner join Station s on t.stationId=s.stationId
    where trainNumberId='F681391E-8FBB-49FC-8159-AE7FA5FF5A36'
    order by sortCode
    View Code

    0,

    C,功能实现代码(Function Implementation Code)返回顶部

    1,

    2,

    warn 作者:ylbtech
    出处:http://ylbtech.cnblogs.com/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    [RTT例程练习] 3.1 动态内存管理之rt_malloc和rt_free
    [RTT例程练习] 3.3 静态内存管理,内存池mempool
    [RTT例程练习] 6.2 在 Finsh 中运行自定义函数
    [RTT例程练习] 2.9 事件机制event
    [SCons 有点翻译的scons学习] 3. 生成和使用库
    [RTT例程练习] 3.2 动态内存管理之rt_realloc和free
    vim 启动 python的自动补全
    [RTT例程练习] 6.1 Finsh 的基本使用
    ELF文件重定位
    [RTT例程练习] 4.2 动态定时器
  • 原文地址:https://www.cnblogs.com/ylbtech/p/5918934.html
Copyright © 2011-2022 走看看