- MySQL 5
- Any MySQL visual tool (e.g., Sequel)
Steps:
-
Create a MySQL data named 'evosqldemo'
-
Create these tables:
-- Create syntax for TABLE 'category'
CREATE TABLE `category` (
`id` int(11) DEFAULT NULL,
`name` varchar(500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Create syntax for TABLE 'product'
CREATE TABLE `product` (
`id` int(11) DEFAULT NULL,
`name` varchar(500) DEFAULT NULL,
`manufacturer` varchar(500) DEFAULT NULL,
`price` double DEFAULT NULL,
`category_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
Create a
evosqldemouser (withevosqldemopassword) with privileges to theevosqldemodatabase. -
Open your IntelliJ and configure this project.
-
Go to the
evosqlfolder. -
Run
sh run.sh exampleN, where N is the number of the example. There are 4 available in the folder.- Example 1: A query with a few conditions (with integers and strings)
- Example 2: A query with a database-specific function (reverse)
- Example 3: A query with a JOIN
- Example 4: A query with a subquery
- Examples 5, 6: More string functions
-
Go back to your IDE. A new
SQLTestexampleNjava file was created in thesrc/test/java/tutorialfolder. -
Comment out the calls to
createTables()anddropTables(). We don't need them for now. -
Run it! Sometimes IntelliJ complains Do not forget to make source level 8. Go to File -> Project Structure, and set the Language Level.
You can find them here: https://docs.google.com/presentation/d/1QMekg1mUI0sHXM4GR7qw8x4-daoSfhvo28jrPamZ92c/edit?usp=sharing.