Sie sind auf Seite 1von 3

Which SQL statement is used to extract data from a database?

select Which SQL statement is used to update data in a database? update Which SQL statement is used to delete data from a database? delete Which SQL statement is used to insert new data in a database? INSERT INTO With SQL, how do you select a column named "FirstName" from a table named "Persons"? SELECT FirstName FROM Persons With SQL, how do you select all the columns from a table named "Persons"? SELECT*FROM PERSONS With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"? SELECT * FROM Persons WHERE FirstName='Peter' With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"? The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true True With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"? SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson' With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"? SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen' Which SQL statement is used to return only different values? SELLECT DIFFERENT Which SQL keyword is used to sort the result-set? ORDER BY With SQL, how can you insert a new record into the "Persons" table? INSERT INTO Persons VALUES ('Jimmy', 'Jackson') With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table? INSERT INTO Persons (LastName) VALUES ('Olsen') With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table? DELETE FROM Persons WHERE FirstName = 'Peter' SQL is an acronym for Structured Query Language and is a standard relational query language (SQL has been standardized by both ANSI and ISO) used for interaction with databases. SQL was developed by IBM in 1970s and has its roots in the relational algebra defined by Codd in 1972. SQL functionality goes beyond the relational algebra, allowing to retrieve data, insert data,

modify existing data and delete data from/to a RDBMS. SQL features arithmetic operators like division, multiplication, subtraction and addition, and comparison operators (=, >=, <=). SQL also defines several aggregate functions like MAX, MIN, AVG, COUNT, and SUM. SQL defines many keywords, which can be divided into several categories. The first SQL keyword category is for keywords used for data retrieval like the SELECT keyword. The second category is for the SQL keywords used for data manipulation like the INSERT, UPDATE, and DELETE SQL keywords. The third category is the transactional SQL keywords category, featuring keywords like COMMIT and ROLLBACK. Another SQL keyword category is the SQL Data Definition Language category featuring words like CREATE and DROP. Yet another category of SQL keywords controls the authorization and permission aspects of RDBMS (GRANT and REVOKE keywords). SQL is pronounced as S-Q-L or see-quill. SQL uses -- character sequence as a single line comment identifier. SQL commands are not case sensitive and the following SQL queries are equivalent: SELECT * FROM Users select * from Users There are many SQL implementations also called SQL dialects and SQL extensions. For example MS SQL Server specific version of the SQL is called Transact-SQL, Oracle version of SQL is called PL/SQL, MS Access version of SQL is called JET SQL. This SQL Tutorial will show you how to use SQL and its commands. You will be able to apply most of the knowledge gathered from this SQL tutorial to any Relational Database Management System. INSERT INTO Users (FirstName, LastName, DateOfBirth, Email, City) VALUES ('Frank', 'Drummer', '10/08/1955', 'frank.drummer@frankdrummermail.com', 'Seattle') SELECT FirstName, LastName, DateOfBirth FROM Users SELECT FirstName, LastName, City FROM Users WHERE City = 'Los Angeles'

UPDATE Users SET Email = 'new_email_goes_here@yahoo.com' WHERE Email = 'sgrant@sgrantemail.com' DELETE FROM Users WHERE LastName = 'Grant' SELECT * FROM Users ORDER BY FirstName SELECT DISTINCT City FROM Users

SELECT COUNT (*) FROM Sales WHERE CustomerName = 'Smith'

Das könnte Ihnen auch gefallen