SQL

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Operators in The WHERE Clause

= Equal <> Not equal. *Note: In some versions of SQL this operator may be written as !=* > Greater than < Less than >= Greater than or equal <= Less than or equal BETWEEN Between an inclusive range LIKE Search for a pattern IN To specify multiple possible values for a column

SQL DELETE Syntax

DELETE FROM table_name WHERE some_column=some_value;

SQL INSERT INTO Syntax

INSERT INTO table_name (column1,column2,column3,...) VALUES ('value1','value2','value3',...); Can be used to insert values in all columns or in only specific columns.The columns where no value is inserted will display as Null.

What is RDBMS?

RDBMS stands for Relational Database Management System. RDBMS is the basis for SQL, and for all modern database systems such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access. The data in RDBMS is stored in database objects called tables. A table is a collection of related data entries and it consists of columns and rows.

SQL AND Operators Syntax

SELECT * FROM Customers WHERE Country='Germany' AND City='Berlin';

SQL OR Operators

SELECT * FROM Customers WHERE City='Berlin' OR City='München';

SQL Operators Combining AND & OR

SELECT * FROM Customers WHERE Country='Germany' AND (City='Berlin' OR City='München');

SQL ORDER BY Syntax

SELECT column_name,column_name FROM table_name ORDER BY column_name,column_name ASC|DESC; * to identify the unique records in the list of records,also may use Distinct syntax* * can be used to order by single column or multiple columns.When using multiple columns, use the asc/desc next to the column name in whom you wish to see the order*

SQL WHERE Clause syntax

SELECT column_name,column_name FROM table_name WHERE column_name operator value;

SQL UPDATE SYNTAX

UPDATE table_name SET column1=value1,column2=value2,... WHERE some_column=some_value; *The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!*

What is SQL

SQL is a standard language for accessing databases. •SQL stands for Structured Query Language •SQL lets you access and manipulate databases •SQL is an ANSI (American National Standards Institute) standard

SQL AND & OR Operators

The AND & OR operators are used to filter records based on more than one condition. The AND operator displays a record if both the first condition AND the second condition are true. The OR operator displays a record if either the first condition OR the second condition is true.

SQL DELETE Statement

The DELETE statement is used to delete rows in a table.

SQL ORDER BY Keyword

The ORDER BY keyword is used to sort the result-set by one or more columns. The ORDER BY keyword sorts the records in ascending order by default. To sort the records in a descending order, you can use the DESC keyword.

SQL SELECT Statement

The SELECT statement is used to select data from a database. The result is stored in a result table, called the result-set

SQL UPDATEStatement

The UPDATE statement is used to update existing records in a table.

SQL WHERE Clause

The WHERE clause is used to extract only those records that fulfill a specified criterion

SQL SELECT DISTINCT Statement

To select and return only distinct values. This command is used when we know that the table has duplicate values and we require only DISTINCT values. This command is useful to identify the unique values in a tables.

SQL SELECT Syntax

To select specific columns: SELECT column_name, column_name FROM table_name; and /or To select entire columns in a table SELECT * FROM table_name;

SQL SELECT DISTINCT Syntax

To select the distinct values from specific columns SELECT DISTINCT column_name,column_name FROM table_name;

What do you need if you want to show data from my webpage

Using SQL in Your Web Site To build a web site that shows data from a database, you will need: •An RDBMS database program (i.e. MS Access, SQL Server, MySQL) •To use a server-side scripting language, like PHP or ASP •To use SQL to get the data you want •To use HTML / CSS

SQL INSERT INTO Statement

used to insert new records in a table.

What Can SQL do?

• SQL can execute queries against a database •SQL can retrieve data from a database •SQL can insert records in a database •SQL can update records in a database •SQL can delete records from a database •SQL can create new databases •SQL can create new tables in a database •SQL can create stored procedures in a database •SQL can create views in a database •SQL can set permissions on tables, procedures, and views

Some of The Most Important SQL Commands

•SELECT - extracts data from a database •UPDATE - updates data in a database •DELETE - deletes data from a database •INSERT INTO - inserts new data into a database •CREATE DATABASE - creates a new database •ALTER DATABASE - modifies a database •CREATE TABLE - creates a new table •ALTER TABLE - modifies a table •DROP TABLE - deletes a table •CREATE INDEX - creates an index (search key) •DROP INDEX - deletes an index


Kaugnay na mga set ng pag-aaral

Aj/Patrick/Jessica/Savannah, Wrinkle, chp 7-8

View Set

California Real Estate Principles - Chapter 4 Terms

View Set

Recording Act & Chain of Title Problems

View Set

BIO 50B LAB TEST 1, BIO 50B Exam 1, DIGESTIVE/ URINARY EXAM, Respiratory & Urinary Exam (Bio 50B), Heart Exam, BIO 50 B TEST 2

View Set

Chapter 3 Inheritance and Polymorphism

View Set

Chapter 7 Intermediate Accounting

View Set

Fluid and Electrolytes - Lewis based

View Set

Early Onset of Labor - ATI CH 10

View Set

Physics and Math: Light and Optics

View Set