나는 데이터베이스 테스트를 내일하고 누군가가 나를 위해이 대답을 확인할 수 있기를 바랍니다. 나는이의 스키마를 가지고 말 :이 관계형 대수가 정확한가?
branch (branch_name, branch_city, assets)
customer (customer_name, customer_street, customer_city)
account (account_number, branch_name, balance)
loan (loan_number, branch_name, amount)
depositor (customer_name, account_number)
borrower (customer_name, loan_number)
내가 궁금합니다 질문 : 는 "이상 £ 5,000의 대출 그러나 더 £ 이하의 잔액이없는 계정이있는 모든 고객의 이름을 찾아라 500. "
원래 코드 :
π customer_name
(σ amount > 5,000^balance < 500
(borrower ⋈ loan ⋈ depositor ⋈ account))
편집 :
π customer_name
(σ amount > 5,000 (borrower ⋈ loan))
-
π customer_name
(σ balance < 500 (depositor ⋈ account))
가 올바른지인가요 : 어윈 Smout의 조언을 보았다면서, 나는 다음에 내 코드를 수정했습니다?
이것은 대학 숙제처럼 보입니다. [sqlfiddle] (http://sqlfiddle.com/) 예제를 설정할 수 있습니까? –
안녕하세요. 실제 SQL 쿼리를 실행하지 않고 sqlfiddle이 작동하지만 관계형 대수 연산자는 작동합니까? –
아마도 그렇지 않습니다. 그것이 언제 효과가 있었는지 어떻게 알았습니까? 어떻게 테스트 해볼까요? 증거를 써요? 이것은 [프로그래머 StackExchange] (http://programmers.stackexchange.com)에게 더 좋은 질문이 될 것입니다. –