SQL Tutorials
Step-by-step lessons for beginners. Copy the code, run it in your editor, and start building real websites.
Xampp Installation
Learn how to install Xampp server:
step 1- Open your browser and go to:
👉 www.apachefriends.org
step 2- Click on XAMPP for Windows to download the latest version.
step 3- Click on green colour botton (download latest version)
step 4- For installation use Local Disk(C)
step 5- After installation click start of Apache and MySql, then minimize the window.
CMD command
Start xampp server with cmd command.
Create database
Create database in xampp server.
Show databases
Show created databases.
Use database
Use created database.
Create table university
Create a new table in database.
Desc university
Show structure of the university table.
Create table student
Create another new table in database.
Desc student
Show structure of the student table.
Insert into university
Enter data into university table.
Insert into student
Enter data into student table.
Select all from university
Show data in all columns in university table.
Select all from student
Show data in all columns in student table.
Select name from student
Displays only the name column from the student table.
Select name as "Undergraduates" from students
Displays the name column, but the output heading is renamed to Undergraduates.
Select indexno, name from students
Shows only the index number and name columns from the students table.
Select indexno, name as "Undergraduates" from students
Shows the index number and the name column, but names are displayed under the heading Undergraduates.
Select indexno, name as "Undergraduates" from students Order By indexno Desc
Displays index number and name (as Undergraduates) sorted by index number in descending order (largest to smallest).
Select indexno, name as "Undergraduates" from students Order By name Desc
Displays index number and name (as Undergraduates) sorted by name in descending alphabetical order (Z → A).
Select distinct name from students
Shows only unique names from the students table (removes duplicates).
ALTER table university
Used to modify the structure of the university table (e.g., add, delete, or change columns).
Desc university
Shows the structure (columns, types, keys) of the university table.
Select all from university
Displays all data from the university table.
Update university
Used to change/update data in the university table.
Select all from university
Displays all data from the university table
Select payment from university where name like 'university of technology'
Shows the payment column for the university named “university of technology”.
Select payment all 1000 as "Income" from university where name like 'university of technology'
Adds 1000 to the payment and shows it under the heading Income.
Select count (IndexNo) from student where uniid like 'UOO1'
Counts the number of students in the student table whose university ID is UOO1.
📊 Learn SQL Basics (W3Schools)
Want to work with databases? Learn how to use SQL to store, manage, and retrieve data efficiently. Start with the basics of SELECT, INSERT, UPDATE, and DELETE commands in this beginner-friendly tutorial.
👉 Learn SQL on W3Schools
← Back to LearnScience