What is Sql: Definition and 77 Discussions

SQL ( (listen) S-Q-L, "sequel"; Structured Query Language) is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS). It is particularly useful in handling structured data, i.e. data incorporating relations among entities and variables.
SQL offers two main advantages over older read–write APIs such as ISAM or VSAM. Firstly, it introduced the concept of accessing many records with one single command. Secondly, it eliminates the need to specify how to reach a record, e.g. with or without an index.
Originally based upon relational algebra and tuple relational calculus, SQL consists of many types of statements, which may be informally classed as sublanguages, commonly: a data query language (DQL), a data definition language (DDL), a data control language (DCL), and a data manipulation language (DML). The scope of SQL includes data query, data manipulation (insert, update and delete), data definition (schema creation and modification), and data access control. Although SQL is essentially a declarative language (4GL), it also includes procedural elements.
SQL was one of the first commercial languages to use Edgar F. Codd’s relational model. The model was described in his influential 1970 paper, "A Relational Model of Data for Large Shared Data Banks". Despite not entirely adhering to the relational model as described by Codd, it became the most widely used database language.SQL became a standard of the American National Standards Institute (ANSI) in 1986, and of the International Organization for Standardization (ISO) in 1987. Since then, the standard has been revised to include a larger set of features. Despite the existence of standards, most SQL code requires at least some changes before being ported to different database systems.

View More On Wikipedia.org
  1. shivajikobardan

    What is intermediate-advanced SQL and how to learn it?

    Non-DBA advanced part: For me subqueries, HAVING clause, GROUP BY clause, CTEs, Indexing, Optimization etc are advanced sql queries. This is mostly used for data analyst, data scientist etc type I mean. For DBA part: No idea What is advanced sql and how'd you learn it. For data analyst...
  2. shivajikobardan

    Best courses to revise SQL in 2 days?

    I am customer support engineer intern. My supervisor has assignmed me to learn SQL in 2 days. I've studied mysql in the past as well. https://www.w3schools.com/sql/ He has asked me to learn till SQL data types. Are there any video courses to revise my sql using mysql? Remember that this is for...
  3. C

    Comp Sci SQL WHERE Clause: Repetitions & Order Explained

    I expect output as 30,20,3,2,1 in a row but I am getting repetitions of these with 20,30 coming 3 times and 3,2 coming 18 times and 1 coming 16 times. I dont understand how combination of condition in where is leading to so many duplicates. Instead of using or if I divide the query into 2 and...
  4. BWV

    Speeding Up SQL Query: Grouping & Joining

    I have a T-SQL query (MS SQL Server) that runs slowly due to the six inner joins I need to get the data I want. The seven tables of data I am working with consist of four of category data and three of quantitative - and the query, which is not important to the question, just makes calculations...
  5. M

    MHB SQL commands with subtraction and multiplication

    Hey! :giggle: The following relations of a project administration of a company are given, where the primary key of the respective relations are underlined. An employee can be assigned to several projects. Furthermore, an employee can have different competencies, which are billed at different...
  6. M

    MHB SQL Expressions for RADL Database

    Hey! :giggle: Use the RADL database as a basis for formulating the following SQL commands. 1. Give an SQL expression that outputs all personnel information for the employee Ernst Pach. 2. Give an SQL expression that outputs all personnel information about the employees, who earn more than...
  7. Wrichik Basu

    Searching & Displaying Items in Android App Using Java & SQL

    This is actually for my new Android app. But everything is written in Java and SQL; there is almost nothing that is specific to Android. I have a database, and the following three tables are of interest here: itemEntity with columns: itemID: integer primary key itemName: String; indexed to be...
  8. W

    Any Experience with SQL Server Dev + Python& ML Server?

    Hi all, Curious if anyone has worked with SQL Server Dev 2017 with ML and Python Server, i.e., with the full data analysis platform and what your experiences are.
  9. W

    Trouble Connecting to Default Instance in SQL Server 2017 (Win10)

    Hi All, Trying to do some querying in my (local) SQL Server. Thing is I am having trouble accessing my default instance, though no trouble accessing the one named instance I have. I have been to Stack Overflow , read up, posted a few things, then told to read again after it all failed. I get a...
  10. W

    Installing SQL Server Dev Config Manager (Snap in)

    Hi All, It seems SQL Server's Dev 2017 config manager does not come " built in" within , and it is now a snap in. When I try to install it through Control Panel, I get the error message: Cannot connect to WMI provider. You do not have permission or the server is unreachable...
  11. W

    Is T-SQL, Declarative Extensions of SQL Necessary?

    Hi, Just curious: I was told, without proof, that declarative ( i.e., not purely imperative) versions of SQL are not strictly necessary, i.e., that anything that can be done within declarative extensions can also be done within the imperative "restriction" . So, e.g., anything in SQL Server that...
  12. ZeGato

    Other Practical book on relational databases with SQL

    Hello, I'm looking for a book on relational databases, that uses SQL, that is practical with lots of examples, and the least possible amount of jargon. Specifically, I have issues understanding how to translate the E/R model into the relational model (relations to tables), and the book that I...
  13. W

    Amateur Dev Q: Creating Front End for SQL Server DB

    Hi All, I am kind of new to this, please be patient. I appreciate your input I have a SQL Server DB, I am trying to create a remote front end to give graphical, or at least simple access to the DB (Client-Server, of course). I would appreciate some suggestions. This is my way of breaking...
  14. W

    I installed SQL Server in Win10....Without Config Manager?

    [I cannot find my SQL Server Configuration Manager] Hi, I have installed both SQL Server Express 2017 and SQL Server Developer 2017 (Separately; not one as a Default or Otherwise Instance) , and they have both run without any major problem. Issue now is that I want to allow a remote connection...
  15. W

    Inserting Missing Data into Adventure Works 2014

    Hi All, Somehow the copy of AdventureWorks2014 I downloaded ( saved and restored) is missing the data, i.e., it contains the schema : tables, indexes, etc. , but many tables are missing the actual data. I have not done any delete/truncate/drop operations, so this may have been a problem with my...
  16. W

    Difference in order of execution and design in SQL Server.

    Hi, given Sql server executes queries order from, where, group by, having, select, order by. Why don't we write queries in same order? Would that improve speed of execution ?
  17. W

    Disabling Constraints in SQL server?

    Hi, I want to practice queries that require having repeated records. This is not allowed by default since it violates uniqueness constraint. Do I just use an alter table drop unique constraint for this?
  18. W

    Can't find my Localhost Database Engine for SQL Server

    Hi All, I had to reinstall my SQL Server and I a having trouble finding the database engine which is the local host. Please see screenshots. Any ideas? Thanks.
  19. W

    Equivalent to Joining tables (SQL) in Excel?

    Hi All, Sorry if this seems pretty lost. I want to compute an expression of the type A/B with data given in different sheets, i.e., A is given in sheet i and b is given in sheet j. Now, I know that in SQL Server ( SQL in general), one can join tables. Is there a similar way of getting data...
  20. W

    Copying Databases between Different Versions of SQL Server

    Hi All, I am trying to move databases ( together with associated data objects) between an instance in SQL Server Express (2016) and an instance living in SQL Server Developer 2017. I know that, between instances of the same version I can : 1) Copy the script in one instance and run it in the...
  21. W

    Is Upgrading or Reinstalling Better for SQL Server Developer Now Free?

    Hope this is acceptable and the right place to post: SQL Server Developer now free: https://www.microsoft.com/en-us/sql-server/sql-server-downloads Just thought some may be interested.
  22. W

    Segway for Presentation: SQl Server/Database and Data Mining

    Hi All, I need to do a presentation in the subject areas of SQL Server, general Database into the area of Data Mining for a job interview. Any Ideas? First thought is the use of SSAS ( Analysis Service) and SSDT ( Data Tools) from SQL Server in Data Mining. But this does not seem...
  23. W

    A Transcription from SQL to FOL (First Order Logic)

    Hi All, When a query is made in SQL , it is transcribed into FOL in the back end , and, if the transcription is a wff , the models, if any, are returned as the answer to the query. I have an idea of how the transcription works for basic statements, but, does anyone know the actual "...
  24. W

    Front End Connected to Database Back End -- Requirements?

    Hi All, Say I have a SQL Server ( or more general, if possible) back end, i.e., stored at the server level. Now, I want to create a front-end, say Access fron- end ( again, if possible, more general ). I know one thing I need : to create a physical connection between the two, most likely...
  25. W

    Embarrassingly Simple SQL Server query: List Even numbers in....

    Hi, I am trying to find all the even numbers in [FieldName] in SQL Server. My query is : SELECT [FieldName] FROM Table WHERE [FieldName] % 2 =0 ; I only get an error message . ( I am using SQL Zoo, since I don't have SQL server available at the moment. Only message I get is that the query is...
  26. S

    How has SQL Server not gone the way of the dinosaur?

    I use SQL Server at my job and for my personal projects (only because I'm familiar with it). Nevertheless I am always amazed at how the language doesn't provide any simple ways of solving common problems. For example, let's say I have some data which represents rows I want to insert or update...
  27. kolleamm

    Creating SQL Tables: What Do I Need to Know?

    I created a database on my website, and now I'm guessing I have to add tables for the information. I have no idea what I'm looking at when I'm asked to create a table.
  28. A

    JavaScript Unable to retrieve blob from SQL database in IE11

    Hi, I am storing a blob in my database running wamp64/MySQL and I am using AJAX to retrieve it. The code works with Chrome, Edge, and FireFox but I obtain the error message "Invalid State Error" in the debugger for the line "xmlhttp.responseType='arraybuffer'" when I run it under IE11. I...
  29. L

    Need resources for ER diagram and SQL

    I have a gut feeling that I will retake a test about these subjects. Do you know good resources about creating ER diagram and relational model for database (sql database primarily) Sometimes even creating a correct ER Diagram (chen notation) feels difficult and confusing. These type of...
  30. Pepper Mint

    SQL Server OpenRowSet on Unknown Table

    SELECT c.object_id AS id, convert(smallint, c.column_id) AS number, s.colid, s.status, convert(varbinary(8000), s.text) AS ctext, convert(smallint, 2 + 4 * (s.status & 1)) AS texttype, convert(smallint, 0) AS language, s.text FROM...
  31. W

    Why are tables not showing up in Object explorer in database

    Hi all, I successfully created (scripted) a database in MS SQL Server 2012. My problem is that while the database itself is listed in the object explorer , the tables from the database are not. The database I scripted did not contain actual data, i.e., there were no 'Insert' statements. Is this...
  32. A

    What sparked my interest in gravity, space, and technology: A personal journey

    Hi i have an interest in gravity, space, and general developments. Background in in Telecoms and IT to management level. I Operate out of own business providing information solutions of various kinds from data collection, processing to visualisation. I always had an interest in electronics as a...
  33. W

    SQL Stored Procedures as Front End?

    Hi, Just curious: is it possible/feasible to use SQL stored procedures as a front end? I mean, couldn't we design stored procedures to allow for easier querying if we knew the general type of queries that would be used for the application (of course, the application for which we designed the...
  34. W

    Equality of Tables in SQL Part II

    Hi all, I think I found the answer to determine whether two SQL tables are equal. Symmetric difference of sets: A(Symmetric Difference) B = ## A \cup B - (A\cap B) ##. One can show that sets A,B are equal iff A (Symmetric Difference) B =A (=B, of course) How does one implement this in the...
  35. W

    Importing flat files (e.g.) Excel directly into SQL Database

    Hi all, I have a bunch of legacy files I am trying to import directly into an .sql database. Is there a way of doing this other than by using Microsoft's import/export Wizard?
  36. W

    Name for "Concatenation Operator"(Rel. Algebra, SQL)

    Hi All, When operating on tables T1, T2 and obtaining a table T3, one obtains rows {##r_{3k}##} in T3 that are obtained from rows {## r_{1i}##} and {##r_{2j} ##} by what I call "concatenation" . I wonder if there is a formal name for it. Specifically, say, during an inner join between T1...
  37. W

    Renaming Columns in DB Table: Apex SQL or Examine Dependenci

    Hi All, Just curious as to what those with experience in creating databases believe is the best method when renaming databases: using Apex SQL , which (supposedly) automatically checks for dependencies or just sitting down , looking at the dependencies and doing the changes one by one as needed...
  38. E

    How to extract .mdf from .bak in SQL Server 2005

    I have a 6GB .bak file that, when check it in the file to use for restore, the file shows 'Incomplete'. I need to extract the .mdf part of the .bak file since I don't need the .log file. There should be some way to do this or some tool out there that will either repair the .bak file so it...
  39. W

    Can I ORDER BY an Alias Column (MSSQL)?

    Hi All, I am doing a query in which I am ALIASING a column name, say 'column name' AS x Can I , at the end of the query ORDER BY x, or must I ORDER BY the given initial 'column name'? (Still having trouble downloading free copy of MSSQL2012, so I cannot test the query). I know this has to see...
  40. S

    'Operand type clash: numeric is incompatible with uniqueiden

    Could use some help figuring out the error Operand type clash: numeric is incompatible with uniqueidentifier which points to the specified line below CREATE PROCEDURE AddPartner @name NVARCHAR(50), @email NVARCHAR(254), @new_guid UNIQUEIDENTIFIER OUTPUT AS BEGIN SET NOCOUNT ON...
  41. W

    "Interesting" or general Mathematical User-defined Functions

    Hi all, just curious. I am just learning about user-defined functions in MSSQL2014. What kind of Math can we do with it? Didn't get much useful from my search.
  42. W

    Basic SQL Queries: Find Max Customers & Products Handled

    Hi all, I am reviewing some material and I have been stuck on these (I am a slow starter, I guess) 1) I have the table Customer, which has an entry on sales reps for customers. I want to know which sales rep handles the most customers. Here is what is given Customer ( CustNum PK, CustName...
  43. S

    SQL joins illustrated as Venn diagrams

    In my opinion, using Venn diagrams, or set theory in general, to help aspiring SQL programmers (yes, SQL is a programming language) understand joins causes nothing but confusion for literal-, logical-thinking persons like myself. Allow me to explain my opinion. Venn diagrams have always been...
  44. W

    Protocol for PKs (Primary Keys) with Null Entries?

    Hi all :I have the table Emp (EmpNum PK, EmpLastNM, EmpEducation, EmpDependent, EmpEducation,...EMpHireDate) which I want to normalize and then I want to do an ERD for it. I must break this into tables one for which , it seems, I cannot have a non-null PK: Now EmpDependent is both...
  45. W

    Formal Definition of Inner Join?

    Hi All, Hope this is not too simple/dumb. I think I have a good idea of what an inner join of two SQL tables T1, T2 along a common field F is, but , for an exercise, I am looking for a precise definition. I am looking for a definition of this sort: (please correct if necessary or let me know if...
  46. S

    Are there any good in-depth books on SQL?

    I want to buy a book on SQL, but since I already have a basic level of professional SQL experience I want to make sure I'm getting a book that goes into depth on the underlying implentations of database transactions, the mathematical theory behind relational databases, how to optimize, etc. I'm...
  47. W

    Syntax for DDL table design in MSSQLServer 2014.

    Hi all, I am learning DDL ( as opposed to GUI ) table design in MSSL2014. EDIT I am given a table printout and I want as an output the(a) DDL code that would output the given table. Sorry, I don't have a scanner nor the original file in my PC, I have a table diagram in a piece of paper. I...
  48. W

    [SQL] Rule of Thumb for Queries: Length of String vs Speed?

    Hi all, Just curious as to whether it is a good rule of thumb ( though not an actual rule) that out of two effective queries (i.e., two queries q1, q2 that return the desired result) , the query that is shortest as a string, i.e., has the fewest total words, will run faster? I understand the...
  49. W

    Run SQL File: Free Programs to Execute and Query Output

    Hi all, I have an .sql file; written as a set of commands, as a general text file, with a .sql extension. I need to execute it in order to get some tables as output, and then run some queries on these tables. Are there some free programs to run/execute the file? I got some hits on a search...
  50. W

    Saving SQL queries in .sql file -- What Program to Use?

    Hi all, I have some queries to do, which I want to save as an .sql file. What program can I /must I use to do this? I think I remember at some point using plain old Notepad to write the queries, since these are made of standard English commands, nothing too fancy. Would this work? Thanks.