SQL is a standard language for accessing and manipulating databases. It allows users to retrieve, insert, update, and delete data as well as create databases and tables. Common SQL queries include SELECT, UPDATE, DELETE, INSERT, CREATE DATABASE, ALTER DATABASE, CREATE TABLE, and ALTER TABLE.
This document provides an overview of SQL (Structured Query Language). It defines SQL as a standard language for accessing and manipulating databases. It describes what SQL can do, such as execute queries, retrieve, insert, update and delete data. It also covers important SQL statements (SELECT, UPDATE, DELETE, INSERT), clauses (WHERE, ORDER BY), operators (LIKE), joins, and functions. In addition, it discusses SQL data types, constraints, creating tables and indexes.
SQL is a standard language for creating and manipulating databases. It allows users to define, manipulate, and control access to data in a database. Some key capabilities of SQL include creating and deleting tables, inserting, updating, and deleting rows of data, retrieving data with queries, and setting access privileges for database users and applications. SQL is supported by many popular database systems like Oracle, MySQL, SQL Server, and PostgreSQL.
Database is a collection of organized data that allows for easy updating and modification of stored data. Data is stored permanently in tables which organize data into rows and columns. SQL is the language used to access and modify database data using statements. DDL statements are used to define database schema through commands like Create, Alter, and Drop. DML statements manipulate data through Insert, Update, Delete, and Select commands. JDBC provides an API for connecting Java programs to databases to perform operations like executing statements and queries, and retrieving and modifying data.
This document provides an overview of SQL and PL/SQL concepts including data definition language (DDL), data manipulation language (DML), data control language (DCL), and transaction control language (TCL). It discusses SQL commands to create, modify and delete database objects as well as manipulate data. It also covers PL/SQL concepts such as stored procedures, functions, cursors and triggers. Indexes and their use in improving query performance are also summarized.
This document provides an introduction to SQL (Structured Query Language). It defines SQL as a standard language for storing, manipulating, and retrieving data from databases. The key objectives of SQL are outlined, including creating database structures, performing basic data management tasks like inserting/updating/deleting data, and executing both simple and complex queries. The different SQL statements are introduced, such as CREATE, DROP, ALTER, SELECT, INSERT, UPDATE, DELETE. Data types, constraints, operators, functions and other SQL elements are also defined.
SQL.pptx for the begineers and good knowPavithSingh
SQL is a standard language for storing, manipulating and retrieving data in relational databases. It allows users to define database structures, create tables, establish relationships between tables and query data. Popular uses of SQL include inserting, updating, deleting and selecting data from database tables. SQL is widely used across industries for managing large datasets efficiently in relational database management systems like MySQL, Oracle and SQL Server.
SQL is a language used in most relational database systems to define, manipulate, and control data. It consists of several key statements including CREATE, SELECT, INSERT, UPDATE, DELETE, and DROP to define databases, tables, retrieve, modify and delete data, as well as DROP tables. SQL also defines various data types that specify the type of data that can be stored in columns.
This document provides an overview of SQL (Structured Query Language) and relational database concepts. It defines SQL, RDBMS, and DBMS. It explains the basic SQL statements for creating databases and tables, inserting, updating, deleting and selecting data. It also covers SQL operators like AND, OR, and NOT for filtering query results. The key points covered are:
- SQL is a standardized language used to manage and query relational database data.
- An RDBMS uses a table structure to store related data elements and ensure data integrity.
- Common SQL statements are CREATE, INSERT, SELECT, UPDATE, DELETE to manage database objects and data.
- WHERE, AND, OR, and NOT clauses are
This document provides an overview of SQL (Structured Query Language). It defines SQL as a standard language for accessing and manipulating databases. It describes what SQL can do, such as execute queries, retrieve, insert, update and delete data. It also covers important SQL statements (SELECT, UPDATE, DELETE, INSERT), clauses (WHERE, ORDER BY), operators (LIKE), joins, and functions. In addition, it discusses SQL data types, constraints, creating tables and indexes.
SQL is a standard language for creating and manipulating databases. It allows users to define, manipulate, and control access to data in a database. Some key capabilities of SQL include creating and deleting tables, inserting, updating, and deleting rows of data, retrieving data with queries, and setting access privileges for database users and applications. SQL is supported by many popular database systems like Oracle, MySQL, SQL Server, and PostgreSQL.
Database is a collection of organized data that allows for easy updating and modification of stored data. Data is stored permanently in tables which organize data into rows and columns. SQL is the language used to access and modify database data using statements. DDL statements are used to define database schema through commands like Create, Alter, and Drop. DML statements manipulate data through Insert, Update, Delete, and Select commands. JDBC provides an API for connecting Java programs to databases to perform operations like executing statements and queries, and retrieving and modifying data.
This document provides an overview of SQL and PL/SQL concepts including data definition language (DDL), data manipulation language (DML), data control language (DCL), and transaction control language (TCL). It discusses SQL commands to create, modify and delete database objects as well as manipulate data. It also covers PL/SQL concepts such as stored procedures, functions, cursors and triggers. Indexes and their use in improving query performance are also summarized.
This document provides an introduction to SQL (Structured Query Language). It defines SQL as a standard language for storing, manipulating, and retrieving data from databases. The key objectives of SQL are outlined, including creating database structures, performing basic data management tasks like inserting/updating/deleting data, and executing both simple and complex queries. The different SQL statements are introduced, such as CREATE, DROP, ALTER, SELECT, INSERT, UPDATE, DELETE. Data types, constraints, operators, functions and other SQL elements are also defined.
SQL.pptx for the begineers and good knowPavithSingh
SQL is a standard language for storing, manipulating and retrieving data in relational databases. It allows users to define database structures, create tables, establish relationships between tables and query data. Popular uses of SQL include inserting, updating, deleting and selecting data from database tables. SQL is widely used across industries for managing large datasets efficiently in relational database management systems like MySQL, Oracle and SQL Server.
SQL is a language used in most relational database systems to define, manipulate, and control data. It consists of several key statements including CREATE, SELECT, INSERT, UPDATE, DELETE, and DROP to define databases, tables, retrieve, modify and delete data, as well as DROP tables. SQL also defines various data types that specify the type of data that can be stored in columns.
This document provides an overview of SQL (Structured Query Language) and relational database concepts. It defines SQL, RDBMS, and DBMS. It explains the basic SQL statements for creating databases and tables, inserting, updating, deleting and selecting data. It also covers SQL operators like AND, OR, and NOT for filtering query results. The key points covered are:
- SQL is a standardized language used to manage and query relational database data.
- An RDBMS uses a table structure to store related data elements and ensure data integrity.
- Common SQL statements are CREATE, INSERT, SELECT, UPDATE, DELETE to manage database objects and data.
- WHERE, AND, OR, and NOT clauses are
The document discusses relational database management systems and the SQL language. It provides information on some key concepts:
1. Tables are the fundamental data structure in relational databases, organized as rows and columns. Each table has a unique name and columns must have unique names within the table.
2. SQL is the standard language used to communicate with relational databases to organize, manage and retrieve data. Key SQL commands include SELECT, INSERT, UPDATE, DELETE.
3. ALTER TABLE, CREATE TABLE, DROP TABLE, and other commands are used to define and modify database structure. Data types supported include numeric, date, text. Columns can be added, modified, or dropped from tables.
This document provides an overview of SQL Server and database development concepts. It covers topics such as SQL Server objects, databases, tables, data types, relationships, constraints, identity columns, computed columns, indexes, views, SQL statements for data manipulation and definition, operators like WHERE, ORDER BY, JOIN, and wildcards. The document is intended as a learning guide for those looking to develop databases using Microsoft SQL Server.
This document provides an introduction to SQL and PostgreSQL. It defines what a database and relational database are, and notes that PostgreSQL is an example of a relational database management system (RDBMS). It describes how data is organized in tables with rows and columns in a relational database. The document outlines common SQL commands like CREATE TABLE, SELECT, WHERE, JOIN, and functions. It provides examples of joining multiple tables and using subqueries.
Aggregate functions in SQL perform calculations on multiple values from a column and return a single value. The document discusses various aggregate functions like COUNT, SUM, AVG, MIN, MAX and how they are used. It also covers topics like views, joins, constraints and how to create, update, delete views and constraints.
This document provides an introduction to structured query language (SQL). It outlines the basic commands and functions of SQL for data administration and manipulation. These include using SQL to create tables, indexes and views; and to add, modify, delete and retrieve data. The document also discusses SQL queries, constraints, indexes, joins and aggregate functions to extract useful information from databases.
The document discusses various SQL aggregate functions such as COUNT, SUM, AVG, MIN, MAX. It explains that aggregate functions perform calculations on multiple values from one or more columns and return a single value. The document also covers SQL views, joins, constraints and dropping constraints. It provides syntax examples for creating views, performing different types of joins (inner, left, right, full outer), and describes various constraint types like primary key, foreign key, unique key, not null.
This document introduces structured query language (SQL) and its basic commands and functions. It discusses how SQL is used for data administration, such as creating tables, indexes, and views, and for data manipulation like adding, modifying, deleting, and retrieving data. The two broad categories of SQL functions are data definition language for creating database objects and data manipulation language for inserting, updating, deleting, and retrieving data from tables.
Lec 1 = introduction to structured query language (sql)Faisal Anwar
This document provides an introduction to structured query language (SQL). It outlines the basic commands and functions of SQL for data administration and manipulation. SQL functions are divided into two categories: data definition language for creating database objects and tables, and data manipulation language for inserting, updating, deleting, and retrieving data. The document also covers topics such as data types, constraints, indexes, joins, and aggregate functions.
This document provides an outline of a SQL Lab tutorial covering MySQL. It introduces SQL and connecting to MySQL. It then covers various MySQL commands including administration commands, data definition language commands to create/drop databases and tables, data manipulation language commands to insert, retrieve, update and delete records, and more advanced queries using concepts like joins, aggregation, and pattern matching. SQL is introduced as a standard language for accessing and manipulating database systems and working with different database programs.
Introduction to structured query language (sql)Dhani Ahmad
This chapter discusses the basics of Structured Query Language (SQL) including how to use SQL commands to define databases and tables, manipulate data by inserting, updating, and deleting rows, and retrieve data through queries. It covers SQL commands for data definition, data manipulation, and data queries and includes examples of creating tables and inserting, updating, and selecting data.
SQL is a standard language for storing, manipulating and retrieving data in databases. It allows users to access and manipulate data in databases. Some key functions of SQL include executing queries against a database, retrieving data from a database, inserting, updating and deleting records in a database, and creating, altering and dropping database objects like tables.
This document provides an overview of the relational database language SQL. It begins by defining basic data types in SQL like numbers, characters, dates and times. It then discusses the SQL Data Definition Language (DDL) which is used to define and modify database schemas and objects. Specific DDL commands like CREATE, DROP, ALTER, TRUNCATE and RENAME are described. The document also covers the SQL Data Manipulation Language (DML) including commands for queries, inserts, updates and deletes. Additional topics discussed include constraints, indexes, views and the advantages of SQL.
This document discusses how to manage tables in a database including creating, modifying, and dropping tables. The key points are:
1. A table stores data in rows and columns and is created using the CREATE TABLE statement.
2. Tables can be modified using the ALTER TABLE statement to add, modify, or drop columns and constraints.
3. Integrity constraints like primary keys, foreign keys, checks and defaults are applied to tables to maintain data integrity.
4. External tables allow querying data stored outside the database in flat files and are created using the CREATE TABLE statement with the ORGANIZATION EXTERNAL clause.
This document provides an introduction and overview of SQL (Structured Query Language). It begins with contact details for instructors and then covers the following key points in 3 sentences or less:
The history of SQL is outlined beginning in 1970 with E.F. Codd's development of the relational database concept through various SQL standards releases. Popular database management systems that support SQL are listed along with an overview of what SQL can do including retrieving, manipulating and defining data. The main components of SQL - DDL, DML, DCL, TCL, and DQL - are defined along with some common commands like SELECT, INSERT, UPDATE, DELETE, CREATE TABLE and more.
Consists of the explanations of the basics of SQL and commands of SQL.Helpful for II PU NCERT students and also degree studeents to understand some basic things.
This document provides an overview of SQL Server database development concepts including SQL Server objects, tables, data types, relationships, constraints, indexes, views, queries, joins, stored procedures and more. It begins with introductory content on SQL Server and databases and then covers these topics through detailed explanations and examples in a structured outline.
The document provides an overview and agenda for an SQL programming training, covering SQL fundamentals like data definition, modification, queries, joins, functions and more. It discusses the history and evolution of SQL and how it is used to build, manipulate and access relational databases. Examples are provided throughout to illustrate concepts like different types of queries, joins, functions and other SQL features.
The document discusses various components and concepts related to database management systems (DBMS). It defines a database as a collection of related data organized for easy access, management, and updating. It describes the main components of a DBMS as hardware, software, data, procedures, and database access language. It also discusses key DBMS concepts like data definition language, data manipulation language, functions, constraints, and having clause.
Different types of database management systems are discussed including hierarchical, relational, object-oriented, and object-relational. Relational database systems started in the 1970s and are still widely used today through systems like Oracle, SQL Server, and MySQL. The document discusses roles in database development and administration including administrator, developer, and architect roles. It also covers database concepts like normalization, relationships, and server configuration.
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
The document discusses relational database management systems and the SQL language. It provides information on some key concepts:
1. Tables are the fundamental data structure in relational databases, organized as rows and columns. Each table has a unique name and columns must have unique names within the table.
2. SQL is the standard language used to communicate with relational databases to organize, manage and retrieve data. Key SQL commands include SELECT, INSERT, UPDATE, DELETE.
3. ALTER TABLE, CREATE TABLE, DROP TABLE, and other commands are used to define and modify database structure. Data types supported include numeric, date, text. Columns can be added, modified, or dropped from tables.
This document provides an overview of SQL Server and database development concepts. It covers topics such as SQL Server objects, databases, tables, data types, relationships, constraints, identity columns, computed columns, indexes, views, SQL statements for data manipulation and definition, operators like WHERE, ORDER BY, JOIN, and wildcards. The document is intended as a learning guide for those looking to develop databases using Microsoft SQL Server.
This document provides an introduction to SQL and PostgreSQL. It defines what a database and relational database are, and notes that PostgreSQL is an example of a relational database management system (RDBMS). It describes how data is organized in tables with rows and columns in a relational database. The document outlines common SQL commands like CREATE TABLE, SELECT, WHERE, JOIN, and functions. It provides examples of joining multiple tables and using subqueries.
Aggregate functions in SQL perform calculations on multiple values from a column and return a single value. The document discusses various aggregate functions like COUNT, SUM, AVG, MIN, MAX and how they are used. It also covers topics like views, joins, constraints and how to create, update, delete views and constraints.
This document provides an introduction to structured query language (SQL). It outlines the basic commands and functions of SQL for data administration and manipulation. These include using SQL to create tables, indexes and views; and to add, modify, delete and retrieve data. The document also discusses SQL queries, constraints, indexes, joins and aggregate functions to extract useful information from databases.
The document discusses various SQL aggregate functions such as COUNT, SUM, AVG, MIN, MAX. It explains that aggregate functions perform calculations on multiple values from one or more columns and return a single value. The document also covers SQL views, joins, constraints and dropping constraints. It provides syntax examples for creating views, performing different types of joins (inner, left, right, full outer), and describes various constraint types like primary key, foreign key, unique key, not null.
This document introduces structured query language (SQL) and its basic commands and functions. It discusses how SQL is used for data administration, such as creating tables, indexes, and views, and for data manipulation like adding, modifying, deleting, and retrieving data. The two broad categories of SQL functions are data definition language for creating database objects and data manipulation language for inserting, updating, deleting, and retrieving data from tables.
Lec 1 = introduction to structured query language (sql)Faisal Anwar
This document provides an introduction to structured query language (SQL). It outlines the basic commands and functions of SQL for data administration and manipulation. SQL functions are divided into two categories: data definition language for creating database objects and tables, and data manipulation language for inserting, updating, deleting, and retrieving data. The document also covers topics such as data types, constraints, indexes, joins, and aggregate functions.
This document provides an outline of a SQL Lab tutorial covering MySQL. It introduces SQL and connecting to MySQL. It then covers various MySQL commands including administration commands, data definition language commands to create/drop databases and tables, data manipulation language commands to insert, retrieve, update and delete records, and more advanced queries using concepts like joins, aggregation, and pattern matching. SQL is introduced as a standard language for accessing and manipulating database systems and working with different database programs.
Introduction to structured query language (sql)Dhani Ahmad
This chapter discusses the basics of Structured Query Language (SQL) including how to use SQL commands to define databases and tables, manipulate data by inserting, updating, and deleting rows, and retrieve data through queries. It covers SQL commands for data definition, data manipulation, and data queries and includes examples of creating tables and inserting, updating, and selecting data.
SQL is a standard language for storing, manipulating and retrieving data in databases. It allows users to access and manipulate data in databases. Some key functions of SQL include executing queries against a database, retrieving data from a database, inserting, updating and deleting records in a database, and creating, altering and dropping database objects like tables.
This document provides an overview of the relational database language SQL. It begins by defining basic data types in SQL like numbers, characters, dates and times. It then discusses the SQL Data Definition Language (DDL) which is used to define and modify database schemas and objects. Specific DDL commands like CREATE, DROP, ALTER, TRUNCATE and RENAME are described. The document also covers the SQL Data Manipulation Language (DML) including commands for queries, inserts, updates and deletes. Additional topics discussed include constraints, indexes, views and the advantages of SQL.
This document discusses how to manage tables in a database including creating, modifying, and dropping tables. The key points are:
1. A table stores data in rows and columns and is created using the CREATE TABLE statement.
2. Tables can be modified using the ALTER TABLE statement to add, modify, or drop columns and constraints.
3. Integrity constraints like primary keys, foreign keys, checks and defaults are applied to tables to maintain data integrity.
4. External tables allow querying data stored outside the database in flat files and are created using the CREATE TABLE statement with the ORGANIZATION EXTERNAL clause.
This document provides an introduction and overview of SQL (Structured Query Language). It begins with contact details for instructors and then covers the following key points in 3 sentences or less:
The history of SQL is outlined beginning in 1970 with E.F. Codd's development of the relational database concept through various SQL standards releases. Popular database management systems that support SQL are listed along with an overview of what SQL can do including retrieving, manipulating and defining data. The main components of SQL - DDL, DML, DCL, TCL, and DQL - are defined along with some common commands like SELECT, INSERT, UPDATE, DELETE, CREATE TABLE and more.
Consists of the explanations of the basics of SQL and commands of SQL.Helpful for II PU NCERT students and also degree studeents to understand some basic things.
This document provides an overview of SQL Server database development concepts including SQL Server objects, tables, data types, relationships, constraints, indexes, views, queries, joins, stored procedures and more. It begins with introductory content on SQL Server and databases and then covers these topics through detailed explanations and examples in a structured outline.
The document provides an overview and agenda for an SQL programming training, covering SQL fundamentals like data definition, modification, queries, joins, functions and more. It discusses the history and evolution of SQL and how it is used to build, manipulate and access relational databases. Examples are provided throughout to illustrate concepts like different types of queries, joins, functions and other SQL features.
The document discusses various components and concepts related to database management systems (DBMS). It defines a database as a collection of related data organized for easy access, management, and updating. It describes the main components of a DBMS as hardware, software, data, procedures, and database access language. It also discusses key DBMS concepts like data definition language, data manipulation language, functions, constraints, and having clause.
Different types of database management systems are discussed including hierarchical, relational, object-oriented, and object-relational. Relational database systems started in the 1970s and are still widely used today through systems like Oracle, SQL Server, and MySQL. The document discusses roles in database development and administration including administrator, developer, and architect roles. It also covers database concepts like normalization, relationships, and server configuration.
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
How to Make a Field Mandatory in Odoo 17Celine George
In Odoo, making a field required can be done through both Python code and XML views. When you set the required attribute to True in Python code, it makes the field required across all views where it's used. Conversely, when you set the required attribute in XML views, it makes the field required only in the context of that particular view.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
This presentation was provided by Steph Pollock of The American Psychological Association’s Journals Program, and Damita Snow, of The American Society of Civil Engineers (ASCE), for the initial session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session One: 'Setting Expectations: a DEIA Primer,' was held June 6, 2024.
How to Fix the Import Error in the Odoo 17Celine George
An import error occurs when a program fails to import a module or library, disrupting its execution. In languages like Python, this issue arises when the specified module cannot be found or accessed, hindering the program's functionality. Resolving import errors is crucial for maintaining smooth software operation and uninterrupted development processes.
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
2. WHAT IS SQL
SQL is a standard language for accessing and manipulating databases.
What is SQL?
•SQL stands for Structured Query Language
•SQL lets you access and manipulate databases
•SQL is an ANSI (American National Standards Institute) standard
What Can SQL do?
•SQL can execute queries against a database
•SQL can retrieve data from a database
•SQL can insert, update and create records in a database
•SQL can delete records from 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
•SQL can create new databases
3. REMEMBER
• SQL is NOT case sensitive: select is the same as
SELECT, however it is better to follow the same style.
• Some database systems require a semicolon at the end
of each SQL statement.
• Semicolon is the standard way to separate each SQL
statement in database systems that allow more than
one SQL statement to be executed in the same call to
the server.
4. SQL QUERIES
• Few important queries are:
• 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
5. SQL SELECT
• The SELECT statement is used to select data from a
database.The result is stored in a result table, called the
result-set.
• Syntax:
• SELECT column_name,column_name FROM table_name;
and
• SELECT * FROM table_name;
6. SQL DISTINCT
• The SELECT DISTINCT statement is used to return only distinct
(different) values
• In a table, a column may contain many duplicate values; and
sometimes you only want to list the different (distinct) values. The
DISTINCT keyword can be used to return only distinct (different)
values.
• Syntax
• SELECT DISTINCT column_name,column_name
FROM table_name;
7. SQL WHERE
• The WHERE clause is used to filter records.
• The WHERE clause is used to extract only those
records that fulfill a specified criterion.
• Syntax
• SELECT column_name,column_name
FROM table_name
WHERE column_name operator value;
8. SQL AND / OR
• 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.
• Syntax:
• SELECT * FROM Customers
WHERE Country='Germany'
AND City='Berlin';
9. SQL ORDER BY
• The ORDER BY keyword is used to sort the result-set.
• 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.
• Syntax
• SELECT column_name, column_name
FROM table_name
ORDER
BY column_name ASC|DESC, column_name ASC|DES
C;
10. SQL UPDATE
• The UPDATE statement is used to update existing records in a table.
• 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!
11. SQL DELETE
• The DELETE statement is used to delete records in a table.
• The SQL DELETE Statement
• The DELETE statement is used to delete rows in a table.
• Syntax
• DELETE FROM table_name
WHERE some_column=some_value;
• The WHERE clause specifies which record or records that should be
deleted. If you omit the WHERE clause, all records will be deleted!
12. SQL SELECT TOP
• The SELECT TOP clause is used to specify the number of
records to return.
• The SELECT TOP clause can be very useful on large tables
with thousands of records. Returning a large number of records
can impact on performance.
• Note: Not all database systems support the SELECT TOP
clause.
• Syntax
• SELECT TOP number|percent column_name(s)
FROM table_name;
13. SQL LIKE
• The LIKE operator is used in a WHERE clause to search for a specified
pattern in a column.
• The LIKE operator is used to search for a specified pattern in a column.
• Syntax
• SELECT column_name(s)
FROM table_name
WHERE column_name LIKE pattern;
14. SQL IN
• The IN operator allows you to specify multiple values in
a WHERE clause.
• Syntax
• SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...);
15. SQL BETWEEN
• The BETWEEN operator is used to select values within a range.
• The BETWEEN operator selects values within a range. The values can be numbers, text,
or dates.
• Syntax
• SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value1 AND value2;
16. SQL ALIAS
• SQL aliases are used to give a database table, or a column in a table, a
temporary name.
• Basically aliases are created to make column names more readable.
• Alias Syntax for Columns
• SELECT column_name AS alias_name
FROM table_name;
• Alias Syntax for Tables
• SELECT column_name(s)
FROM table_name AS alias_name;
17. SELECT INTO
• With SQL, you can copy information from one table into another.
• The SELECT INTO statement copies data from one table and inserts it into a new table.
• Syntax
• We can copy all columns into the new table:
• SELECT *
INTO newtable
FROM table1;
• Or we can copy only the columns we want into the new table:
• SELECT column_name(s)
INTO newtable FROM table1;
• The new table will be created with the column-names and types as defined in the SELECT
statement. You can apply new names using the AS clause.
•
18. SQL INSERT
• The INSERT INTO statement is used to insert new records in a table.
• Syntax
• It is possible to write the INSERT INTO statement in two forms.
• The first form does not specify the column names where the data will be
inserted, only their values:
• INSERT INTO table_name
VALUES (value1,value2,value3,...);
• The second form specifies both the column names and the
values to be inserted:
• INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);
•
19. INSERT INTO
• The INSERT INTO SELECT statement copies data from one table and
inserts it into an existing table.
• The INSERT INTO SELECT statement selects data from one table
and inserts it into an existing table. Any existing rows in the target
table are unaffected.
• Syntax
• We can copy all columns from one table to another, existing table:
• INSERT INTO table2
SELECT * FROM table1;
• Or we can copy only the columns we want to into another, existing
table:
• INSERT INTO table2
(column_name(s))
SELECT column_name(s)
FROM table1;
20. CREATE DATABASE
• The CREATE DATABASE statement is used to create a
database.
• Syntax
• CREATE DATABASE dbname;
• SQL CREATE DATABASE Example
• The following SQL statement creates a database called
"my_db":
• CREATE DATABASE my_db;
21. CREATE TABLE
• The CREATE TABLE statement is used to create a table in a database.
• Tables are organized into rows and columns; and each table must have a
name.
• Syntax
• CREATE TABLE table_name
(
column_name1 data_type(size),
column_name2 data_type(size),
column_name3 data_type(size),
....
);
• The column_name parameters specify the names of the columns of the
table.
• The data_type parameter specifies what type of data the column can hold
(e.g. varchar, integer, decimal, date, etc.).
• The size parameter specifies the maximum length of the column of the table.