Handling SQL Queries Using XAMPP Server

What is XAMPP Server

XAMPP is a Free full-fledged development environment that lets you install the Apache web server, MariaDB database, Perl, and PHP scripting languages in one installation. It is a free solution stack for website developers, including a web server, database server, and scripting engines—production environments.

What is SQL?

SQL stands for structured query language. It is a standard language used to communicate with the relational database.

Almost every function, such as retrieving data from the database, creating a new database, and manipulating data in the database, such as insertion, deletion, and updating, can be easily performed using SQL. It is a user-friendly as well as a domain-specific language.

Need of SQL

  1. It is widely used in business Intelligence tools.
  2. Data Manipulation and Data Testing are done through SQL.
  3. Data Science Tools depend highly on SQL. Big data tools, such as Spark, Impala, etc., depending on SQL.
  4. It is one of the most demanding industrial skills.
  5. It can facilitate tons of transactions at the same time.

Features of SQL

  1. It is open-source and has a vibrant community of developers who are there to provide updates and troubleshooting assistance.
  2. Despite heavy workloads and high usage, SQL is high-performance.
  3. It suits Organizations of any size.
  4. It is highly scalable, meaning the tables can be created, overwritten, and deleted at the user’s convenience.
  5. SQL offers great security features.

Benefits of SQL

SQL has many advantages, which make it popular and highly in demand in the industry. It is a reliable and efficient language used for communicating with the database. Also, ANSI (American National Standards Institute) recognizes SQL as an essential part of the technology industry, and it is the standard language for database management systems in the United States.

  1. Faster Query Processing
  2. No Coding Skills Required
  3. Standardized Language
  4. Portable
  5. Interactive
  6. Offers Multiple Data Views as per User

Drawbacks of SQL

Although SQL has many advantages, there are a few drawbacks, too, which are discussed below:

  1. Complex Interface: SQL has a complex interface, making it difficult for beginners sometimes to get comfortable with it.
  2. Cost: Some of the versions of SQL are costly; hence programmers cannot afford them.
  3. Partial Control: Due to hidden business rules, complete database control is not given to DBA itself.

Applications of SQL

  1. SQL is used by Developers and DBAs (Data Administrators) in writing data integration scripts.
  2. It is widely used to deal with analytical queries to analyze the data and get instincts from it.
  3. Widely used in social media, Music Industry, Finance Industry, and Educational Institutes.
  4. They are widely used in Music Industry.
  5. They are widely used in Finance Industry and Educational Institutes as well.

How to install XAMPP Server?

STEP 1. We will be using xamp, an open-source package for our SQL Environment. You can download it from here.

STEP 2. After downloading XAMPP double, click on the downloaded setup and the next button.

STEP 3. After that, tick all components to install and click on the next button.

STEP 4. After that, select the location  to install and then click on the next button

STEP 5. After that, click on the next button.

STEP 6. After that setup, you will install XAMPP Server in your system.

STEP 7. After installation, click Finish Button, and you are good to go.

 

How to create a table in MySQL?

STEP 1. After Downloading, install the software and open Xamp Control Panel.

STEP 2. Start the first four services.

STEP 3. Now open any browser, ensure you’re connected to the internet, and navigate to http://localhost/phpmyadmin/.

STEP 4. Click on SQL Tab.

STEP 5. First, we will create a database and type the following query.

create database <database name>;

For instance, we will name our database as CSharp_Articles, i.e.,                                        

create database CSharp_Articles;

After that, click on the GO button at the bottom right of the page.

Your database will be created as shown below:

STEP 6. We will create an Article table with two fields, Author and Word Length.

create table <tablename>(
Field1 datatype (size),
Field2 datatype (size));

In our case query will be as follows:

create table Article(
word_length INT(3),
author char(36));

On Successful execution, your screen will look like

STEP 7. Now we will insert the values in our table.

To insert values, we will use the insert command.

insert into <tablename> values
(),
(),
...
();

For Example,

insert into articles values
(500,"Mr. Bond"),
(300,"Mrs. Brown"),
(600,"Mr. Austin");

Upon Successful Execution, your screen will look like this:

STEP 8. Now lets us display our table contents. We use the select *query to show all the table contents.

select * from <tablename>;

For example, selecting * from articles will display all the contents in the table articles. Below is the result of this query.

If we want to display only selected content in a table, let's say We want to display the entries where word_Length is more significant than 300;

Then we will type our query like this:

select * from articles where word_length>300;

Upon Successful Execution, your result will be displayed as:

STEP 9. Now If we want to delete the data inside the table, we will use a truncate query.

truncate table <tablename>;

For example,

Truncate table articles;

It will ask for your confirmation. If you click ok, all the records in your table will be cleared.

STEP 10. Now let us say you want to delete the whole table from your database.

Then also SQL provides a query for that, which is a drop table query.

DROP table <tablename>;

For Example,

 drop table articles;

It will prompt you for confirmation, and if you click yes/okay, then your table will be deleted from the whole database;

STEP 11. The DROP query can also be used to delete the whole database. We will use a drop query like this to delete the database.

DROP DATABASE databasename;

For Example,

DROP DATABASE CSharp_Articles;

The above query will delete the whole database and its tables.

Conclusion

So far, we have been introduced to SQL, its significance, and its need in the Industry. Not only this, but we also had to look at its advantages, disadvantages, and applications in real life. Further, we also learned and performed some basic queries of SQL, which were very easy and informative.


Similar Articles