DEV Community

Saifulhaq S
Saifulhaq S

Posted on

Getting Started with SQL: My First Hands-On Experience

Over the past few days, I started learning SQL (Structured Query Language) and performed some of the most essential operations that every beginner should know. Databases power almost every application we use today, and SQL is the language that helps us communicate with them.
I practiced queries on a simple Students–Courses database and here’s what I tried:

  1. Creating Tables (DDL) I started with the CREATE TABLE command to define the structure of my tables. For example: CREATE TABLE Faculty ( FacultyID INT PRIMARY KEY, FacultyName VARCHAR2(100) NOT NULL, Dept VARCHAR2(50), Email VARCHAR2(100) UNIQUE ); This helped me understand how to set primary keys, constraints, and column types.
  2. Inserting Data (DML) Next, I used the INSERT INTO statement to add records into my tables. For example, I added some students into different departments. INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES (1, 'Saifulhaq', 'CSBS', TO_DATE('13-12-2006','DD-MM-YYYY'), 'itsaifulhaq@gmail.com');
  3. Altering Tables I learned how to modify table structures using the ALTER TABLE command. For instance, I added a phone number column: ALTER TABLE Students ADD PhoneNo VARCHAR2(10);
  4. Using Functions in SELECT I also explored SQL functions to manipulate and display data. Example: SELECT UPPER(Name) AS StudentName, LENGTH(Email) AS EmailLength FROM Students; This query shows student names in uppercase and calculates the length of their email IDs.
  5. Aggregate Functions SQL makes it easy to calculate statistics. I tried: SELECT AVG(Credits) AS AvgCredits FROM Courses; SELECT COUNT(*) AS TotalStudents FROM Students;
  6. Joins Finally, I experimented with joins to combine data from multiple tables: SELECT s.Name, c.CourseName, e.Grade FROM Students s JOIN Enrollments e ON s.StudentID = e.StudentID JOIN Courses c ON e.CourseID = c.CourseID; This lists all students with the courses they’re enrolled in and their grades. Final Thoughts 💡 Writing and executing these SQL queries gave me a solid understanding of how relational databases work. It’s one thing to learn the theory, but actually running queries and seeing the results makes it click much faster. I’ll be sharing more of my learning journey soon — especially as I explore advanced SQL queries and dive deeper into database design.

Thank you @santhoshnc sir for your valuable guidance...








Top comments (0)