Writing basic SQL queries
In the previous example, we wrote our very first SQL query, which involves the SELECT
statement. This time, we will learn how to use some other SQL statements, such as INSERT
, UPDATE
, and DELETE
.
How to do it…
Let's create a simple program that demonstrates basic SQL query commands by following these steps:
- We can use our previous project files, but there are couples of things we need to change. First, open up
mainwindow.ui
and replace the labels for name and age with line edit widgets. Then, add three buttons to the canvas and call them Update, Insert, and Delete: - After that, open up
mainwindow.h
and add the following variables ...
Get Qt5 C++ GUI Programming Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.