Is there a programming language specifically designed for interacting with SQL databases that avoids the need for Object-Relational Mappers (ORMs) to solve impedance mismatch from the start?

If such a language exists, would it be a viable alternative to PHP or Go for a web backend project?

  • pixxelkick@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    3 months ago

    This is not a problem for a modern ORM, JOINs are supported by most ORMs I’ve worked with for many years.

    Var cars = await db.Cars
        .Include(c => c.Wheels)
        ToListAsync();
    
    foreach (var car in cars)
    {
        Console.WriteLine(car.Model);
        foreach (var wheel in car.Wheels)
        {
            Console.WriteLine(wheel.Id);
        }
    }
    

    This will get all the cars and their associated wheels in 1 single query by performing a JOIN operation using Entity Framework Core, assuming there’s a FK for Wheel to Car.