create table customer (
  name varchar(30) not null,
  ID varchar(30) not null,
  age number,
  address varchar(200) not null,
  phone varchar(30) not null)create table account (
  customerID varchar (30) not null,
  accountID varchar(30) not null,
  money number not null)create table subaccount (
  accountID varchar(30) not null,
  date varchar(30) not null,
  money number not null)
=============================================================
select accountID from account, customer where account.customerID = customer.ID and customer.name = '张三'
=============================================================
insert into customer (name, ID, age, address, phone) values ('李四', '002', 22, 'aldjfaljdf', '123456')
insert into account (customerID, accountID, money) values ('002', '000002', 1000)
=============================================================
select customer.ID, customer.name, account.accountID, subaccount.date, subaccount.money from customer, account, subaccount where customer.name = '李四' and customer.ID = account.customerID and account.accountID = subaccount.accountID
=============================================================
如何控制的问题,只要在提款前先把当天历史记录以及帐户余额都取出来,然后判断后再处理就OK了

解决方案 »

  1.   

    UP!补充:
    1。字段date的类型用datetime类型。
    2。select customer.ID, customer.name, account.accountID, subaccount.date, subaccount.money from customer, account, subaccount where customer.name = '李四' and customer.ID = account.customerID and account.accountID = subaccount.accountID
    and subaccount.date between '2003-1-1' and '2003-1-24' 
    3。是“一天”可以取款的限额还是“一次”可以取款的限额?? 假如是“一次”的话,就可以修改表字段定义了。
      

  2.   

    你应该不是应聘程序员吧。
    和程序没有关系,SQL  OK 就 OK !
      

  3.   

    to: hch9230(走路的人)
    恩, 是一天之内只能取2000.00大洋。 但是, 比如他先存进了500大洋, 然后立马取走2500.00大洋, 是合法的。
    to: flashroom(找到啦)
    我是应聘软件工程师的。 题目一共有三类, JAVA, C++, Database。
    java c++ 任选其一, 因为我做过数据库的API,所以我选c++, database,是因为这个公司主要为中国银行, 什么什么银行做MIS的, 所以要考一些金融方面的数据库相关知识。
    to:takecare(大厅) 
       那就露一手吧!
      

  4.   

    上面的都很好实现,我觉得下面的满有意思的:
    用PBENDO CODE(好象是pbendo code ) 或者自然语言写出一笔提款发生时的程序处理流程。
    写个流程。
    交易开始
        输入帐号
        显示相关信息
        输入提款金额
        判断是否大于金额总数
            大于
               结素交易或重新输入
            小于
               正常交易
               登记存款帐分录
               结素交易或继续交易
               
    交易结素