How to use SQL

Author: Eric Farmer
Date Of Creation: 6 March 2021
Update Date: 1 July 2024
Anonim
Learn Basic SQL in 15 Minutes | Business Intelligence For Beginners | SQL Tutorial For Beginners
Video: Learn Basic SQL in 15 Minutes | Business Intelligence For Beginners | SQL Tutorial For Beginners

Content

SQL (stands for Structured Query Language) was originally developed by IBM in the 70s to interact with relational databases. It is a common language for databases and remains fairly readable. And it's relatively easy to learn the basics (although the language can be very powerful).

Steps

  1. 1 SQL 'is usually pronounced' S-Q-L ' (Structured Query Language - structured query language). SQL was originally developed at IBM by Donald D. Chamberlin and Raymond F. Beuys in the early 1970s. This version was called SEQUEL (Structured English Query Language).
  2. 2 There are various dialects of SQL, but the most widely used DBMSs today adhere to the ANSI SQL99 standard, and many vendors have implemented additional features to extend this standard (Microsoft calls the 'feature' of SQL T-SQL or Transact-SQL, the Oracle version is PL / SQL ).
  3. 3 Receiving data! As a rule, this is what we are talking about. To do this, use the SELECT statement - it will query or receive (retrieve) data from the SQL database.
  4. 4 Simple example: ’Select * from tblMyCDList’ - would like to get (select) all columns (this is where the * comes from) and rows of the table ’tblMyCDList’.
  5. 5 Queries are usually much more complex than this. Selection can be used to pull specific columns and rows from a table, and even link data from multiple tables or, for that matter, all databases together.
  6. 6 If we want to filter the rows selected by the select operator, the condition must be qualified as sets of selected records. 'select * from tblMyCDList, where CDid = 27' will show rows where the CDid field is 27. Or 'select * from tblAttribute, where strCDName for example' Dark Side% '' uses an unpredictable phenomenon represented by 0 or other examples of any nature ... And we will show (display) that I have my favorite Pink Floyd album in my collection.
  7. 7 INSERT and UPDATE statements are used to add and modify data in a SQL database (check out the links below for some great tutorials that you might find useful later).
  8. 8 DELETE statement is used to delete data from a SQL database.

Tips

  • Use wamp or xampp - a simpler web server with phpmyadmin (mysql).
  • Under Linux, the most popular databases are MySQL and PostgreSQL. If the console seems awkward, use ExecuteQuery or another similar open source tool.
  • The following book might be helpful: Kline, Kevin, Daniel Kline and Brand Hunt. 2001. SQL in a Nutshell. 2nd Edition. O'Reilly & Associates, Inc.
  • It is very easy to attach to SQL databases from within Microsoft Access (this query tool can be used in SQL mode, although the syntax differs from those used with SQL Server and other databases).
  • Microsoft Query is a tool that comes with Windows - it has graphical or SQL query modes.

Warnings

  • The value 'database' can often be confused; it can be used to talk about a real container for a collection of tables, like a CD database or a master database. The actual server software containing the database is the "database engine" or "database software" that may contain databases. Examples are SQL Server 2005 Express, MySQL, or Access 2003.
  • Relational database usually means 'a system whose users view data in the form of tables linked to each other through shared data values', which is typically implemented as a 'relational database management system' (RDBMS) like MySQL, Sybase, SQL Server or Oracle. Strict relational databases conform to E.F. ‘Ted’ Codd’s ’Twelve Principles of Relational Databases’. It can be argued (and often is) that Access is also a relational database, Microsoft of course talks about this, but the way the kernel is built actually makes it an 'Indexed Sequential Access Method (ISAM)' a database or a monotonous file Database. The differences are not easy to spot at first glance because they are not there, Access even has its own SQL implementation, but they dip into the database engines (see http://www.ssw.com.au/SSW/Database/DatabaseDocsLinks.aspx for a good description of this). Other things that are relevant, some complex queries in Access will run much slower than in SQL Server. Some simple queries will run slower in SQL Server.