Professional Documents
Culture Documents
txt
Class #3.2 : MYSQL Database Demo - How to create database, tables and run queries.
**********************************************************************************
========================
Set 1:
------
INSERT INTO `userinfo` (`user_id`, `name`, `email`, `password`) VALUES ('2', 'selva',
'selva@test.com', 'test12');
Set 2:
------
CREATE TABLE `usertable` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(100) NOT NULL ,
`username` VARCHAR(100) NOT NULL , `password` VARCHAR(100) NOT NULL , `city` VARCHAR(100) NOT NULL
, `age` VARCHAR(100) NOT NULL , `gender` VARCHAR(100) NOT NULL , PRIMARY KEY (`id`));
ALTER TABLE `usertable` ADD `yearofbirth` INT NOT NULL AFTER `city`;
Note : The drop query will delete the table. You need to do the run the create query alone again
to proceed further.
-------------------------
INSERT INTO `usertable` (`id`, `name`, `username`, `password`, `city`, `age`, `gender`) VALUES (1,
'User 1', 'user1@gmail.com', '123456', 'Chennai', '25', 'Male')
Query 2 - Select a user record with a particular user name and password:
Resources:
https://macappstudiobridge.com/SQL_Exercise.txt 1/2
11/2/21, 7:21 PM https://macappstudiobridge.com/SQL_Exercise.txt
Exercises:
Tables:
3. Create a table for storing only food information in a food ordering app
Database:
1. Create a database with a set of tables for online grocery store management
https://macappstudiobridge.com/SQL_Exercise.txt 2/2