⚠️ This lesson is retired and might contain outdated information.

Querying Data in Hasura

Ali Spittel
InstructorAli Spittel
Share this video with your friends

Social Share Links

Send Tweet

In this video, we run a SQL query and a GraphQL query and mutation in Hasura, demonstrating the multiple ways you can access data.

Ali Spittel: [0:00] Now that we have data loaded into our database, we can write some queries to see that data.

[0:06] If you go over to the DATA tab and then click SQL, you can write normal SQL queries. I could do SELECT * FROM "users" and then click Run and see all the users that I have loaded into my database. This is helpful if you want to insert a lot of data into your database. You could do a SQL query to insert data from a CSV or something along those lines.

[0:32] You can also head over to the GraphiQL tab and write some GraphiQL queries. I'm going to use the Explorer tool to get all the users and their id and their username back. You can see that now I have both of my users.

[0:53] We can also write mutations using this GraphiQL Explorer. If you switch over to mutation here, then click that + button, you'll get all the information about creating a mutation. Using this mutation, I can insert one user into the database named "aspit." Then I'll get the username and id back.

[1:14] Hasura allows us to access and manipulate our data in multiple ways, which allows you to write multiple different types of queries.