SQL is a language used to store, manipulate, and retrieve data in relational database management systems. The core SQL commands are CREATE, SELECT, INSERT, UPDATE, and DELETE. CREATE is used to create new tables and objects. SELECT retrieves data from tables. INSERT adds new rows of data. UPDATE modifies existing data. DELETE removes rows of data. SQL allows users and applications to access data, define data structures, and manage 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.
The document provides an overview of SQL commands and operations including:
1) Creating a database and table, inserting and selecting data, updating records with WHERE clauses.
2) Altering tables by adding or modifying columns and constraints.
3) Different SQL statements like SELECT, INSERT, UPDATE and DELETE and clauses like WHERE are discussed along with syntax and examples.
This document provides an introduction to SQL (Structured Query Language). It defines SQL as a standard language for accessing and manipulating databases. The key points covered include:
- SQL lets you perform queries against a database to retrieve, insert, update, and delete data. It can also be used to create and modify database structures.
- Common SQL commands covered are SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, ALTER TABLE, DROP TABLE.
- Additional SQL concepts explained are data types, WHERE clauses, ORDER BY clauses, GROUP BY clauses, and JOIN operations.
- RDBMS systems like MySQL, SQL Server, Oracle, etc. use SQL to communicate with the databases they manage.
This document provides an overview of SQL commands and functions. It covers topics such as creating and manipulating databases and tables, retrieving and modifying data, joining tables, and string operations. Some key points include:
- SQL commands are grouped into DDL, DML, DCL, and DQL for defining, manipulating, controlling, and querying databases.
- Tables can be created with or without constraints and records can be inserted, selected, updated, and deleted from tables.
- Joins allow data to be retrieved from multiple tables. Functions like COUNT, AVG, MIN, MAX, and SUM perform calculations on data.
- String functions allow manipulation of text, including uppercase, lowercase, substring,
SQL is a programming language used to store, manipulate and retrieve data in relational database management systems (RDBMS). It uses data definition language (DDL) to define database schemas, data manipulation language (DML) to insert, update and delete data, and data query language (DQL) to retrieve data from databases. Common SQL commands include CREATE, ALTER, DROP, SELECT, INSERT, UPDATE, DELETE, COMMIT and ROLLBACK. SQL functions and operators like GROUP BY, ORDER BY, DISTINCT, LIKE, AND and OR extend its data querying capabilities.
The document discusses various SQL DDL commands:
- CREATE command is used to create databases and tables. CREATE DATABASE creates a database and CREATE TABLE defines columns and data types.
- ALTER command modifies table structures by adding/dropping columns or changing column properties.
- TRUNCATE quickly empties a table without deleting the structure.
- RENAME sets a new name for an existing table.
- DROP completely removes a table or database, deleting the structure and all data.
This document provides an introduction and overview of SQL and database systems for a BAIS 3rd year class in 2015. It covers topics such as what SQL is, the functions and commands of SQL like SELECT, INSERT, UPDATE and DELETE. It also discusses database objects like tables, records, fields and columns. Specific SQL commands are defined for manipulating and querying database tables, including DDL, DML, DQL, DCL and TCL commands. Examples are provided for creating tables and inserting, updating and deleting records in MySQL.
SQL is a standard language for accessing and manipulating databases. It allows users to retrieve, insert, update, and delete data as well as create, modify and delete tables. The main SQL commands are grouped into four categories: data definition language for creating/modifying database structures, data manipulation language for interacting with data, transaction control language for managing transactions, and data control language for security. Common SQL commands include CREATE, SELECT, INSERT, UPDATE, DELETE, ALTER, and DROP.
"I’m Deepak Singh Kushwaha, with a strong foundation in computer science and hands-on experience in building efficient, data-driven solutions.
I am writing to express my keen interest in the STEP Internship program at Google. With a strong foundation in computer science and practical experience in developing efficient, data-driven solutions, I am excited about the opportunity to contribute to Google’s innovative projects and mission to make technology universally accessible.
Recently, I completed an AI & Prompt Engineering internship with VaultsofCodes, where I worked on natural language processing, prompt generation, and model optimization for real-world applications. This experience honed my analytical and technical problem-solving skills. Prior to this, I served as an Email Deliverability Support Trainee at a digital startup, managing campaigns on Systeme.io, resolving deliverability issues, and enhancing client satisfaction. These roles strengthened both my technical expertise and my ability to communicate effectively within team environments.
I have also developed several web platforms, including a Car Resale Website and a Grocery Management System, utilizing HTML, CSS, JavaScript, PHP, and MySQL. These projects involved extensive testing and iteration, incorporating user feedback to refine the functionality and user experience. My technical toolkit further includes Python (with libraries such as NumPy, Pandas, and Matplotlib), C++, and MySQL. Beyond technical skills, my collaborative nature and adaptability have been sharpened through diverse experiences, including HR and operations work at Nayepankh Foundation.
What draws me most to Google is its commitment to fostering innovation while positively impacting millions of lives. I am eager to contribute to this vision, leveraging my skills to tackle complex challenges, build scalable solutions, and collaborate with some of the brightest minds in the industry.
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.
This document outlines the contents of a manual for a database management systems laboratory course. It covers 5 chapters on different lab programs involving creating database tables, inserting data, and writing queries. Chapter 1 provides an introduction to basic SQL commands including DDL, DML, TCL, and DCL commands. It describes commands like CREATE TABLE, ALTER TABLE, DROP TABLE, SELECT, INSERT, UPDATE, DELETE. Subsequent chapters provide the problem statements, ER diagrams, schema diagrams, code for creating tables and inserting sample data, and solutions to queries for 5 different database domains - library, orders, movies, college, and company.
SQL is a standard language used to access and manage relational database systems. It was originally developed in the 1970s at IBM for use in database management systems. Some popular database systems that support SQL include MySQL, PostgreSQL, Oracle, SQLite, and Microsoft SQL Server. SQL allows users to define and manipulate the structure and data of databases through commands like SELECT, INSERT, UPDATE, DELETE, and more.
The document discusses SQL and its functions. SQL is a language used to store, manipulate, and retrieve data in relational databases. It includes data definition language (DDL) commands like CREATE, ALTER, TRUNCATE, DROP, and RENAME to define and modify database structures. It also includes data manipulation language (DML) commands like INSERT, UPDATE, DELETE, and MERGE to manage data within databases. Examples of each command are provided.
This document provides information about SQL and database management systems. It discusses:
- SQL is a standard language for querying, manipulating, and defining data in databases. It was developed by IBM in the 1970s.
- SQL can be used to perform functions like retrieving data from a database, inserting new records, updating existing records, and deleting records.
- The main components of SQL are DDL, DML, DCL, and DQL which allow creating, modifying and deleting database structures, manipulating data, controlling access to data, and querying data respectively.
- Common SQL statements are discussed including SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE TABLE, and DROP TABLE. Data types and
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.
UNIT-3.pptx Exception Handling and MultithreadingSakkaravarthiS1
The document discusses exception handling and multithreading in Java. It covers exception handling basics like checked and unchecked exceptions. It describes try, catch, throw, throws and finally keywords used in exception handling. It also discusses multiple catch clauses, nested try blocks and built-in exceptions. For multithreading, it defines processes and threads, and how to create multiple threads and handle thread synchronization and priorities in Java.
UNIT-2.pptx CS3391 Inheritance , types, packages and InterfacesSakkaravarthiS1
This document discusses various Java concepts including method overloading, objects as parameters, returning objects, static, nested and inner classes, inheritance basics and types, the super keyword, method overriding and dynamic method dispatch, abstract classes, final with inheritance, packages and interfaces. It provides examples and explanations of each concept.
More Related Content
Similar to Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values, display records (20)
SQL is a programming language used to store, manipulate and retrieve data in relational database management systems (RDBMS). It uses data definition language (DDL) to define database schemas, data manipulation language (DML) to insert, update and delete data, and data query language (DQL) to retrieve data from databases. Common SQL commands include CREATE, ALTER, DROP, SELECT, INSERT, UPDATE, DELETE, COMMIT and ROLLBACK. SQL functions and operators like GROUP BY, ORDER BY, DISTINCT, LIKE, AND and OR extend its data querying capabilities.
The document discusses various SQL DDL commands:
- CREATE command is used to create databases and tables. CREATE DATABASE creates a database and CREATE TABLE defines columns and data types.
- ALTER command modifies table structures by adding/dropping columns or changing column properties.
- TRUNCATE quickly empties a table without deleting the structure.
- RENAME sets a new name for an existing table.
- DROP completely removes a table or database, deleting the structure and all data.
This document provides an introduction and overview of SQL and database systems for a BAIS 3rd year class in 2015. It covers topics such as what SQL is, the functions and commands of SQL like SELECT, INSERT, UPDATE and DELETE. It also discusses database objects like tables, records, fields and columns. Specific SQL commands are defined for manipulating and querying database tables, including DDL, DML, DQL, DCL and TCL commands. Examples are provided for creating tables and inserting, updating and deleting records in MySQL.
SQL is a standard language for accessing and manipulating databases. It allows users to retrieve, insert, update, and delete data as well as create, modify and delete tables. The main SQL commands are grouped into four categories: data definition language for creating/modifying database structures, data manipulation language for interacting with data, transaction control language for managing transactions, and data control language for security. Common SQL commands include CREATE, SELECT, INSERT, UPDATE, DELETE, ALTER, and DROP.
"I’m Deepak Singh Kushwaha, with a strong foundation in computer science and hands-on experience in building efficient, data-driven solutions.
I am writing to express my keen interest in the STEP Internship program at Google. With a strong foundation in computer science and practical experience in developing efficient, data-driven solutions, I am excited about the opportunity to contribute to Google’s innovative projects and mission to make technology universally accessible.
Recently, I completed an AI & Prompt Engineering internship with VaultsofCodes, where I worked on natural language processing, prompt generation, and model optimization for real-world applications. This experience honed my analytical and technical problem-solving skills. Prior to this, I served as an Email Deliverability Support Trainee at a digital startup, managing campaigns on Systeme.io, resolving deliverability issues, and enhancing client satisfaction. These roles strengthened both my technical expertise and my ability to communicate effectively within team environments.
I have also developed several web platforms, including a Car Resale Website and a Grocery Management System, utilizing HTML, CSS, JavaScript, PHP, and MySQL. These projects involved extensive testing and iteration, incorporating user feedback to refine the functionality and user experience. My technical toolkit further includes Python (with libraries such as NumPy, Pandas, and Matplotlib), C++, and MySQL. Beyond technical skills, my collaborative nature and adaptability have been sharpened through diverse experiences, including HR and operations work at Nayepankh Foundation.
What draws me most to Google is its commitment to fostering innovation while positively impacting millions of lives. I am eager to contribute to this vision, leveraging my skills to tackle complex challenges, build scalable solutions, and collaborate with some of the brightest minds in the industry.
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.
This document outlines the contents of a manual for a database management systems laboratory course. It covers 5 chapters on different lab programs involving creating database tables, inserting data, and writing queries. Chapter 1 provides an introduction to basic SQL commands including DDL, DML, TCL, and DCL commands. It describes commands like CREATE TABLE, ALTER TABLE, DROP TABLE, SELECT, INSERT, UPDATE, DELETE. Subsequent chapters provide the problem statements, ER diagrams, schema diagrams, code for creating tables and inserting sample data, and solutions to queries for 5 different database domains - library, orders, movies, college, and company.
SQL is a standard language used to access and manage relational database systems. It was originally developed in the 1970s at IBM for use in database management systems. Some popular database systems that support SQL include MySQL, PostgreSQL, Oracle, SQLite, and Microsoft SQL Server. SQL allows users to define and manipulate the structure and data of databases through commands like SELECT, INSERT, UPDATE, DELETE, and more.
The document discusses SQL and its functions. SQL is a language used to store, manipulate, and retrieve data in relational databases. It includes data definition language (DDL) commands like CREATE, ALTER, TRUNCATE, DROP, and RENAME to define and modify database structures. It also includes data manipulation language (DML) commands like INSERT, UPDATE, DELETE, and MERGE to manage data within databases. Examples of each command are provided.
This document provides information about SQL and database management systems. It discusses:
- SQL is a standard language for querying, manipulating, and defining data in databases. It was developed by IBM in the 1970s.
- SQL can be used to perform functions like retrieving data from a database, inserting new records, updating existing records, and deleting records.
- The main components of SQL are DDL, DML, DCL, and DQL which allow creating, modifying and deleting database structures, manipulating data, controlling access to data, and querying data respectively.
- Common SQL statements are discussed including SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE TABLE, and DROP TABLE. Data types and
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.
UNIT-3.pptx Exception Handling and MultithreadingSakkaravarthiS1
The document discusses exception handling and multithreading in Java. It covers exception handling basics like checked and unchecked exceptions. It describes try, catch, throw, throws and finally keywords used in exception handling. It also discusses multiple catch clauses, nested try blocks and built-in exceptions. For multithreading, it defines processes and threads, and how to create multiple threads and handle thread synchronization and priorities in Java.
UNIT-2.pptx CS3391 Inheritance , types, packages and InterfacesSakkaravarthiS1
This document discusses various Java concepts including method overloading, objects as parameters, returning objects, static, nested and inner classes, inheritance basics and types, the super keyword, method overriding and dynamic method dispatch, abstract classes, final with inheritance, packages and interfaces. It provides examples and explanations of each concept.
UNIT-1 PPT.pptCS 3492 DBMS UNIT 1 to 5 overview Unit 1 slides including purpo...SakkaravarthiS1
This document outlines the contents of a textbook on database system concepts. It includes 5 units: (1) relational databases, (2) database design, (3) transactions, (4) implementation techniques, and (5) advanced topics. For each unit, it lists the main topics that will be covered, such as the relational model, SQL, concurrency control, query processing, and distributed databases. It also provides background information on data models, views of data, and the purpose and advantages of using a database management system over file-based data storage.
DATABASE MANAGEMENT SYSTEMS university course materials useful for students ...SakkaravarthiS1
This document provides information about a database management systems (DBMS) course syllabus. It includes the course objectives, which are to understand basic database concepts, master SQL, understand relational database design principles, and become familiar with transaction processing and concurrency control. The syllabus outlines 5 units that will be covered: data models and languages, the relational model and SQL, normalization, transaction management and recovery, and query processing. Required textbooks and references are also listed.
UNIT 5-JavaFX Event Handling, Controls and Components.pdfSakkaravarthiS1
The document discusses JavaFX, including its features, framework, application structure, and steps to create a basic JavaFX application. It describes JavaFX as a Java library used to develop desktop and rich internet applications that can run on multiple platforms. It provides an overview of JavaFX's features like rich APIs, FXML, scene builder, built-in controls, and CSS styling. It then explains the key components of a JavaFX application - Stage, Scene, and Scene Graph and the role of each. Finally, it outlines the 7 steps to create a basic JavaFX application with a button and event handling.
The document discusses input/output (I/O) in Java, including byte streams, character streams, and reading/writing to the console. It covers:
1) Byte and character streams for handling input/output of bytes and characters respectively. Character streams use Unicode for internationalization.
2) The InputStream, OutputStream, Reader, and Writer classes used for byte and character I/O.
3) Reading input from the console using a BufferedReader connected to System.in, and writing output using PrintStream/PrintWriter connected to System.out.
This presentation highlights project development using software development life cycle (SDLC) with a major focus on incorporating research in the design phase to develop innovative solution. Some case-studies are also highlighted which makes the reader to understand the different phases with practical examples.
Impurities of Water and their Significance.pptxdhanashree78
Impart Taste, Odour, Colour, and Turbidity to water.
Presence of organic matter or industrial wastes or microorganisms (algae) imparts taste and odour to water.
Presence of suspended and colloidal matter imparts turbidity to water.
This study will provide the audience with an understanding of the capabilities of soft tools such as Artificial Neural Networks (ANN), Support Vector Regression (SVR), Model Trees (MT), and Multi-Gene Genetic Programming (MGGP) as a statistical downscaling tool. Many projects are underway around the world to downscale the data from Global Climate Models (GCM). The majority of the statistical tools have a lengthy downscaling pipeline to follow. To improve its accuracy, the GCM data is re-gridded according to the grid points of the observed data, standardized, and, sometimes, bias-removal is required. The current work suggests that future precipitation can be predicted by using precipitation data from the nearest four grid points as input to soft tools and observed precipitation as output. This research aims to estimate precipitation trends in the near future (2021-2050), using 5 GCMs, for Pune, in the state of Maharashtra, India. The findings indicate that each one of the soft tools can model the precipitation with excellent accuracy as compared to the traditional method of Distribution Based Scaling (DBS). The results show that ANN models appear to give the best results, followed by MT, then MGGP, and finally SVR. This work is one of a kind in that it provides insights into the changing monsoon season in Pune. The anticipated average precipitation levels depict a rise of 300–500% in January, along with increases of 200-300% in February and March, and a 100-150% increase for April and December. In contrast, rainfall appears to be decreasing by 20-30% between June and September.
11th International Conference on Data Mining (DaMi 2025)kjim477n
Welcome To DAMI 2025
Submit Your Research Articles...!!!
11th International Conference on Data Mining (DaMi 2025)
July 26 ~ 27, 2025, London, United Kingdom
Submission Deadline : June 07, 2025
Paper Submission : https://csit2025.org/submission/index.php
Contact Us : Here's where you can reach us : [email protected] or [email protected]
For more details visit : Webpage : https://csit2025.org/dami/index
Rearchitecturing a 9-year-old legacy Laravel application.pdfTakumi Amitani
An initiative to re-architect a Laravel legacy application that had been running for 9 years using the following approaches, with the goal of improving the system’s modifiability:
・Event Storming
・Use Case Driven Object Modeling
・Domain Driven Design
・Modular Monolith
・Clean Architecture
This slide was used in PHPxTKY June 2025.
https://phpxtky.connpass.com/event/352685/
This document provides information about the Fifth edition of the magazine "Sthapatya" published by the Association of Civil Engineers (Practicing) Aurangabad. It includes messages from current and past presidents of ACEP, memories and photos from past ACEP events, information on life time achievement awards given by ACEP, and a technical article on concrete maintenance, repairs and strengthening. The document highlights activities of ACEP and provides a technical educational article for members.
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values, display records
1. SQL (pronounced sequel) is an acronym for Structured Query Language, a
standardized language used to access and manipulate data.
SQL enables a programmer or database administrator to do the following:
Modify a database's structure
Change system security settings
Add user permissions on databases or tables
Query a database for information
Update the contents of a database
Guidelines for Writing SQL statements
1. SQL statements are not case sensitive.
2. SQL statements can be on one or more lines.
3. SQL is a free form language.
4. SQL keywords are typically entered in uppercase; all other words such as
table and column names are entered in lowercase.
5. SQL Statements are terminated with a semi-colon.
6. SQL won't execute the query until it finds a semicolon
Language SQL Commands
Data Definition Language
(DDL)
1. CREATE
2. ALTER
3. DROP
4. TRUNCATE
5. RENAME
Data Manipulation Language
(DML)
1. INSERT
2. UPDATE
3. DELETE
Data Query Language (DQL) SELECT
Data Control Language
(DCL)
4. GRANT
5. REVOKE
Transaction Control Language
(TCL)
6. COMMIT
7. ROLLBACK
8. SAVEPOINT
2. STRUCTURE OF RELATIONAL DATABASES:
RDBMS in which data is stored in the form of tables. A relational
database consists of a collection of tables, each of which is assigned a unique
name.
BASIC STRUCTURE
Each column header is attributes. Each attribute allows a set of permitted
values called domain of that attribute.
Table is called as a relation and rows in a table are called as tuples.
The tuples in a relation can be either sorted or unsorted.
Several attributes can have same domain. E.g.: customer_name,
employee_name.
Attributes can also be distinct. E.g.: balance, branch_name
Attributes can have null values incase if the value is unknown or does
not exist.
Account Table
What is Query?
A query is a question.
A query is formulated for a relation/table to retrieve some useful
information from the table.
Data Definition Language (DDL) Commands:
Command Description
CREATE Creates a new table, a view of a table in the database
ALTER Modifies an existing table; used to add a new column,
modify the existing column definition and to include or
drop integrity constraint.
DROP Deletes an entire table, a view of a table in the database.
It will delete the table structure
3. TRUNCATE Truncates the table values without deleting table
structure (the records alone will be deleted)
RENAME This is used to change the name of the table
DESC This is used to view the structure of the table
Table Creation Rules:
1. Reserved words cannot be used as table name
2. The first character of the name must be a letter between A and Z, the
remaining characters can be letters or the symbols _, #, $, and @.
3. Underscore, numerals, letters are allowed but not blank space.
4. Maximum length for the table name is 30 characters.
5. 2 different tables should not have same name.
6. We should specify a unique column name for primary key.
7. We should specify proper data type along with width. (Domain type)
8. We can include “not null” condition when needed. By default, it is ‘null’.
The Field's Data Type – Domain type
Data Type Comments
CHAR Alphanumeric data with a length between 1 and 255
characters. Spaces are padded to the right of the value to
supplement the total allocated length of the column.
DATE Included as part of the date as century, year, month, day, hour,
minute, and second.
NUMBER Numeric 0, positive or negative fixed or floating-point data.
VARCHAR2 Alphanumeric data that is variable length; this field must be
between 1 and 2,000 characters long.
The CREATE Syntax
CREATE TABLE <table name>
(
fieldname-1datatype constraints if any,
fieldname-2 datatype constraints if any,
.......
fieldname-n datatype constraints if any,
);
Example
4. SQL> CREATE TABLE Customer
(
Customer_id int,
Customer_name varchar2(20),
Address varchar2(30),
City varchar2(15)
);
Primary key - it uniquely identifies a row within a table. A table may have only
one primary key, which consists of one or more columns. If the primary key
contains multiple columns it is referred to as a composite primary key or
concatenated primary key.
Syntax
CREATE TABLE <tableName> (<attribute_name> <type> PRIMARY KEY);
CREATE TABLE Student
(
Regno int PRIMARY KEY,
Name varchar2(30),
Marks int
);
Describing the structure of the table
After a table has been created, it may be necessary to determine the name,
data type and some of the constraints of the attributes that compose the table. The
command used is DESC. The syntax of this command is
Syntax
DESC table-name;
SQL> DESC Customer;
Name Type
-----------------------------------------------------
Customer_id int
Customer_name varchar2(20)
Address varchar2(30)
City varchar2(15)
5. The ALTER TABLE Statement
Many times your database design does not account for everything it should.
The ALTER TABLE statement enables the database administrator or
designer to change the structure of a table after it has been created.
The ALTER TABLE command enables you to do two things:
Add a column to an existing table
Modify a column that already exists
Add constraints to an existing table
Removing constraints from a table
The syntax for adding and modifying columns:
ALTER TABLE table_name
<ADD column_name data_type; | MODIFY column_name data_type ;>
Example:
ALTER TABLE Customer ADD DateOfBirth int;
Customer_Id Customer_Name Address City DateOfBirth
Change Data Type Example
Now we want to change the data type of the column named "DateOfBirth"
in the "Customers" table. We use the following SQL statement:
Syntax
ALTER TABLE Customers MODIFY COLUMN DateOfBirth year;
If we want to remove a column then
ALTER TABLE Persons DROP COLUMN DateOfBirth;
The DROP TABLE Statement
SQL provides a command to completely remove a table from a database. The
DROP TABLE command deletes a table along with all its associated views and
indexes. After this command has been issued, there is no turning back.
SYNTAX:
DROP TABLE table_name;
6. Example:
DROP TABLE Orders;
The TRUNCATE TABLE Statement
An easier and faster way of removing all rows from a table is using the
TRUNCATE command.
Syntax
TRUNCATE TABLE tablename;
Example
TRUNCATE TABLE Customer;
Data Manipulation Language Commands in SQL
DML commands are the most frequently used SQL commands and is used to
query and manipulate the existing database objects. Some of the commands are
Insert
Update
Delete
The data manipulation statements are:
The INSERT statement
The UPDATE statement
The DELETE statement
The INSERT...VALUES Statement
The INSERT...VALUES statement enters data into a table one record at a
time.
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...)
The second form specifies both the column names and the values to be inserted:
INSERT INTO table_name (col1, col2...) VALUES (value1, value2...)
7. The DELETE Statement
In addition to adding data to a database, you will also need to delete data
from a database. The syntax for the DELETE statement is
Syntax
DELETE FROM tablename WHERE condition;
Depending on the use of the DELETE statement's WHERE clause, SQL can do
the following:
Delete single rows
Delete multiple rows
Delete all rows
Here are several points to remember when using the DELETE statement:
The DELETE statement cannot delete an individual field's values. The
DELETE statement deletes entire records from a single table.
Using the DELETE statement deletes only records, not the table itself.
Use the DROP TABLE statement to remove an entire table.
Delete All Data - It is possible to delete all rows in a table without deleting the
table. This means that the table structure, attributes, and indexes will be intact:
DELETE FROM table_name; (OR)
DELETE * FROM table_name;
Exercise: