GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.tutorialspoint.com — SQL Databases
Selected Reading
SQL DatabasesThis tutorial introduces SQL Databases, explaining what they are, how they work, and how to use them. It is suitable for students, developers, data analysts, or anyone who wants to learn about relational databases in a simple way. What is an SQL Database?An SQL Database is a type of relational database that stores information in tables made of rows and columns. You use SQL (Structured Query Language) to create, read, update, and delete data in these tables.
Types of SQL DatabasesThere are several types of SQL-based relational databases, each with its own features and uses:
Basic Operations in SQL DatabasesSQL databases allow you to manage your data using simple commands. The main operations you will use are:
Examples of Basic SQL CommandsFollowing are some simple SQL commands that allow you to create databases and tables, add and retrieve data, and make updates or deletions. Creating a DatabaseA database is like a main folder where you keep all the related tables together. It helps you keep different sets of data in one place. This command creates a new database named company where you can store tables and data. You can make another database if you need to keep a different group of tables separate from this one. CREATE DATABASE company; Creating a TableA table is where you keep actual records. Each row is one record and each column stores a single type of detail. Choosing correct column types like numbers or text makes it easier to add and search data later. This creates a table called employees with columns for ID, name, department, and salary: CREATE TABLE employees ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(100), department VARCHAR(50), salary DECIMAL(10,2) ); Inserting DataWhen you insert data, you are putting new rows into the table. Each row holds the values you give for each column. You can insert one record at a time or many records in a single command if needed. Here, it adds a new employee record into the employees table with the specified name, department, and salary: INSERT INTO employees (name, department, salary)
VALUES ('Rohan', 'Sales', 65000);
Retrieving DataRetrieving data lets you look at the rows you have stored. You can show all rows or filter only the ones you want. You can also arrange the output by sorting or by picking certain columns to display. Here, it selects and displays all the records from the employees table: SELECT * FROM employees; Updating DataUpdating means changing values in existing rows. This keeps the stored information correct when something changes. You can update one record or many records at once if they match the given condition. Here, it modifies the salary of the employee named Rohan to 70000: UPDATE employees SET salary = 70000 WHERE name = 'Rohan'; Deleting DataDeleting removes rows that you no longer need. It frees space and keeps the table clean. Be careful when deleting, because once removed the row is gone unless you have a copy saved somewhere else. Here, it removes the record of the employee named Rohan from the table: DELETE FROM employees WHERE name = 'Rohan'; Advantages of SQL DatabasesFollowing are some of the main advantages of using SQL databases:
Common Use Cases for SQL DatabasesSQL databases are used in almost every industry. Some examples include:
ConclusionSQL Databases are tools for storing and managing structured data. By understanding basic concepts like tables, rows, columns, and using simple SQL commands, anyone can organize, retrieve, and update information. They are widely used across industries, making SQL an important skill for developers, analysts, and data professionals. Advertisements
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |