1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Converting Relational Algebra to corresponding SQL Query

Discussão em 'Outras Linguagens' iniciado por Stack, Novembro 3, 2024 às 14:42.

  1. Stack

    Stack Membro Participativo

    I am trying to understand how to convert properly from Relational Algebra into SQL queries

    I find this is one of the things I struggle to convert between. Would anyone be able to share any tips?

    Tables:

    Room(_roomId_, numberOfBeds, price)

    Guest(_guestId_, homeTown, age)

    Reservation(_roomId_, _guestId_, date)


    Relational Algebra:

    Πprice(ΠroomId(ΠguestId(σage<20)Guest) Natural Join Reservation) Natural Join Room


    Query: I managed to deduce the following from part of the statement:

    SELECT roomId FROM (SELECT guestID from Guest WHERE age<20) Natural Join Reservation


    Am I close?

    Continue reading...

Compartilhe esta Página