How to Use SQL: 8 Steps (with Pictures)

Table of contents:

How to Use SQL: 8 Steps (with Pictures)
How to Use SQL: 8 Steps (with Pictures)
Anonim

SQL stands for Structured Query Language and was initially developed by IBM in the 1970s to interact with relational databases. SQL is the common language of databases, quite readable and relatively simple to learn (and also very powerful).

Steps

Use SQL Step 1
Use SQL Step 1

Step 1. 'SQL is pronounced' S-Q-L '(Structured Query Language)

SQL was initially developed by IBM by Donald D. Chaberlin and Raymond F. Boyce in the early 1970s. This first version was called SEQUEL (Structured English Query Language).

Use SQL Step 2
Use SQL Step 2

Step 2. There are many variations of SQL but the most used databases today conform to the ANSI SQL99 standard, and many manufacturers have implemented extra features to the standard (the Microsoft version of SQL is called T-SQL or Transact- SQL, while the Oracle version is PL / SQL)

Use SQL Step 3
Use SQL Step 3

Step 3. Retrieve the data

After all, this is the SQL. To do this, we use the SELECT statement; this statement queries or retrieves data from an SQL database.

Use SQL Step 4
Use SQL Step 4

Step 4. A simple example could be something like:

'select * from tblMyCDList'. This instruction returns all the columns (indicated by the asterisk) and the rows contained in the 'tblMyCDList' table.

Use SQL Step 5
Use SQL Step 5

Step 5. “Queries” are generally more complicated

This statement can be used to extract particular columns and rows as well as links to data from multiple tables, or, for that matter, entire databases.

Use SQL Step 6
Use SQL Step 6

Step 6. If we wanted to filter the columns read through this statement, we would have to include a “where” clause to define the columns to retrieve

'select * from tblMyCDList where CDid = 27' will show lines where the CDid field equals 27. Otherwise, 'select * from tblAttribute where strCDName like' Dark Side% '' uses a wildcard representing zero or more instances of each character, and hopefully tell us that my favorite Pink Floyd album is actually in my collection.

Use SQL Step 7
Use SQL Step 7

Step 7. The INSERT and UPDATE statements are used to add and modify data in the SQL database (in the links listed below you will find excellent guides to learn this language better)

Use SQL Step 8
Use SQL Step 8

Step 8. The DELETE statement is used to remove data from the SQL database

Advice

  • Use wamp or xampp, an easier web server to use with phpmyadmin (mysql)
  • Under Linux, the most popular databases are MySQL and PostgreSQL. If the console isn't your thing, use ExecuteQuery or other similar open source programs.
  • The following books may be helpful to you: Kline, Kevin, Daniel Kline, and Brand Hunt. 2001. SQL in a Nutshell. Second edition. O’Reilly & Associates, Inc.
  • It is very easy to manage SQL databases with Microsoft Access (its query tool can be used in SQL mode, although the syntax differs slightly from that used on SQL servers and other databases).
  • Microsoft Query is a Windows tool - It comes with a graphical interface for SQL queries.

Warnings

  • The meaning of "database" may be confused; the word database can be used to talk about the container of table sets itself, such as a database for a CD collection or a master database. The server software on which the database is located is called "database engine" or "database software", and it is the latter that contains the databases. Examples of these software are SQL Server 2005 Express, MySQL and Access 2003.
  • A relational database is typically a system where users can view data as a collection of tables linked to each other through common data values and is typically implemented in "Relational Database Management System" (RDMS) systems such as MySQL, Sybase, SQL Server or Oracle. Strictly relational database systems follow the 'Twelve Principles of Relational Databases' by E. F. "Ted" Codd. Many consider Access to be a relational database, including Microsoft. The way the engine is built actually makes it an Indexed Sequential Access Method (ISAM) database, or flat file database. The differences are not easy to see at first glance. The Access engine also comes with its own implementation of SQUL (see https://www.ssw.com.au/SSW/Database/DatabaseDocsLinks.aspx for more information). Some operations will be slower on Access, while other simple queries will run slower on SQL Server.

Recommended: