Structured Query Language (SQL) is a standardized programming language that is used to manage relational databases and perform various operations on the data in them.
A database management system (DBMS) is a software application that allows users to store, organize, and manage large amounts of data in a structured and efficient manner. DBMS provides a centralized repository for data that can be accessed and manipulated by multiple users and applications simultaneously.
The primary functions of a DBMS include data storage, data retrieval, data security, and data integrity. DBMS allows users to define, create, and manipulate data using a variety of tools and interfaces, such as SQL queries, forms, and reports.
DBMS typically include features such as transaction management, concurrency control, backup and recovery, and query optimization to ensure the efficient and reliable operation of the system.
DBMS can be categorized into different types based on their architecture, such as relational, object-oriented, and NoSQL. Each type of DBMS has its own strengths and weaknesses, and the choice of DBMS depends on the specific requirements of the application.
Overall, a DBMS plays a critical role in managing large and complex data sets, and it is an essential tool for organizations that need to store, access, and analyze large volumes of data efficiently and effectively.
The document provides an overview of databases and database management systems. It defines what a database is and provides examples. It discusses the objectives and purpose of databases, including controlling redundancy, ease of use, data independence, accuracy, recovery from failure, privacy and security. Key terms related to database design and structure are explained, such as tables, rows, indexes, primary keys and foreign keys. The document also covers data definition language, data manipulation language, SQL, users and types of databases. Factors to consider when selecting a database management system are outlined.
The document provides an introduction to database management systems. It discusses key concepts including:
1. What a database management system (DBMS) is and its main functions like defining database schema, manipulating data, and protecting the database.
2. The typical components of a DBMS including software, data, procedures, and database languages.
3. Basic terminology related to databases like data, records, fields, tables, keys, and different types of databases.
The document provides an introduction to database management systems. It discusses key concepts like types of databases, database terminology, components of a DBMS, benefits of using a DBMS, and different types of databases. Some key points include:
- A DBMS is a collection of programs that enables users to access, manipulate, and control access to databases.
- Core components of a DBMS include software, data, procedures, database languages, and database/runtime managers.
- Benefits of a DBMS include data sharing, access control, integration, and abstraction from physical implementations.
- Database terminology includes concepts like entities, attributes, records, fields, keys, tables, and columns.
- Popular database types include
This document discusses key concepts related to databases and database management systems (DBMS). It defines a database as an organized collection of data, and a DBMS as software that manages databases. The document then discusses different types of database users, the purpose of using a DBMS over file systems, different data models, and SQL statements for defining database structure and manipulating data.
The document discusses key concepts related to databases including:
- A database is an organized collection of data stored electronically and accessed via a DBMS.
- Data is logically organized into records, tables, and databases for meaningful representation to users.
- Databases offer advantages like reduced data redundancy, improved data integrity, and easier data sharing.
- Database subsystems include the database engine, data definition language, and data administration.
The document then covers database types, uses, issues, and security concepts.
This presentation gives an overview of Databases and Term used in used in Databases Aspect. It also, help you to understand the clear description of Database Learning. Best Suited for Beginners and advanced level learners.
This document provides an introduction to fundamentals of database systems. It discusses what a database is, the benefits of using a database over flat files, and the different types of users that interact with databases, including end users, support personnel, database administrators, and database designers. It also describes what a database management system (DBMS) is and its main purposes, such as providing concurrency control, data processing functions, authorization services, integrity services, and user interfaces.
The document discusses the components and advantages of a database management system (DBMS). It identifies the major components of a DBMS as software, hardware, data, procedures, and users. It then describes each component in detail. The document also discusses 14 key advantages of using a DBMS compared to traditional file-based systems, such as controlling data redundancy and inconsistency, enabling data sharing, integration and security, and providing capabilities like atomic transactions, querying, reporting and backup/recovery.
This document provides information about a database management systems (DBMS) course offered by the Department of Computer Science & Engineering at Cambridge University. The course objectives are to provide a strong foundation in database concepts, practice SQL programming, demonstrate transactions and concurrency, and design database applications. Course outcomes include identifying and defining database objects, using SQL, designing simple databases, and developing applications. The course modules cover topics such as conceptual modeling, the relational model, SQL, normalization, transactions, and recovery protocols. Required textbooks are also listed.
The document discusses database management systems (DBMS). It covers topics such as the introduction to databases, components of a DBMS, and applications of DBMS. It defines a DBMS as a system software used to create and manage databases. A DBMS provides users with tools to define, manipulate, retrieve, and manage data. It also discusses the different types of databases like hierarchical, network, relational, and object-oriented databases.
This document is a handbook on database systems authored by Muhammad Sharif. It contains 20 chapters covering topics like data types, data models, database design, normalization, transactions, and Oracle database fundamentals and administration. The handbook provides definitions of key database concepts such as structured vs unstructured data, records and files. It also describes the evolution of database systems from flat files to relational and object-oriented models. Different database architectures including client-server, parallel and distributed systems are explained.
Database system Handbook 3rd DONE Complete DBMS book Full book
dbms
rdbms
relational database systems handbook
database management systems and handbook
This document is a handbook on database systems authored by Muhammad Sharif. It contains 20 chapters covering topics like data types, data models, database design, normalization, transactions, query processing, indexing, security, backup and recovery. It discusses database concepts such as the different data architectures (single-tier, multi-tier, parallel, distributed), database management systems, data storage and the evolution of databases over time. The handbook aims to provide a comprehensive resource on relational database systems and their management.
4rth Complete book Database systems Handbook dbms rdbms by Muhammad Sharif
Database management systems handbook by Muhammad Sharif
#rdbms
dbms
database management systems handbook
database systems handbook
DBA book sql rdbms 4rth Complete book Database systems Handbook dbms rdbms by Muhammad Sharif
#Other names:
#DBMS
#RDBMS
#Relational database systems handbook
Database services management systems
The document discusses the components of a database management system (DBMS). It describes the main components as the DBMS software, hardware, data, procedures, database access language, and users. The software controls and manages the database. The hardware includes storage devices and computers. Data is the most important component, which is stored, updated, and retrieved from databases. Procedures provide instructions for using the DBMS. A database access language like SQL is used to interact with the data. Users include application programmers, database administrators, and end-users.
The document provides an introduction to database management systems. It discusses key concepts such as the purpose of DBMSs, data models, database languages, database design, storage and query processing. It also describes common DBMS components like the data dictionary and different types of database users. Overall, the document serves as a high-level overview of database management systems and lays the foundation for further exploration of topics within this domain.
The document provides an introduction to database management systems and their components. It discusses that a database is a collection of related data representing some aspect of the real world. A database management system (DBMS) allows users to define, construct, manipulate and share databases. The key functions of a DBMS include data definition, data storage, data manipulation such as querying and updating, and sharing data among multiple users. The document also provides examples of database systems and their typical components such as utilities, tools, and centralized and client/server architectures.
Pixel- A pixel, short for "picture element.pptxBINJAD1
A pixel, short for "picture element," is the smallest unit of a digital image or display. It is a tiny square or dot that represents a single point of color. When combined with other pixels, they form the images we see on screens, such as computer monitors, smartphones, and televisions.
Introduction to Computer Graphics or CG.pptBINJAD1
Computer graphics is an art of drawing pictures on computer screens with the help of programming. It involves computations, creation, and manipulation of data.
More Related Content
Similar to Structured Query Language (SQL)- standard Database language (20)
The document discusses key concepts related to databases including:
- A database is an organized collection of data stored electronically and accessed via a DBMS.
- Data is logically organized into records, tables, and databases for meaningful representation to users.
- Databases offer advantages like reduced data redundancy, improved data integrity, and easier data sharing.
- Database subsystems include the database engine, data definition language, and data administration.
The document then covers database types, uses, issues, and security concepts.
This presentation gives an overview of Databases and Term used in used in Databases Aspect. It also, help you to understand the clear description of Database Learning. Best Suited for Beginners and advanced level learners.
This document provides an introduction to fundamentals of database systems. It discusses what a database is, the benefits of using a database over flat files, and the different types of users that interact with databases, including end users, support personnel, database administrators, and database designers. It also describes what a database management system (DBMS) is and its main purposes, such as providing concurrency control, data processing functions, authorization services, integrity services, and user interfaces.
The document discusses the components and advantages of a database management system (DBMS). It identifies the major components of a DBMS as software, hardware, data, procedures, and users. It then describes each component in detail. The document also discusses 14 key advantages of using a DBMS compared to traditional file-based systems, such as controlling data redundancy and inconsistency, enabling data sharing, integration and security, and providing capabilities like atomic transactions, querying, reporting and backup/recovery.
This document provides information about a database management systems (DBMS) course offered by the Department of Computer Science & Engineering at Cambridge University. The course objectives are to provide a strong foundation in database concepts, practice SQL programming, demonstrate transactions and concurrency, and design database applications. Course outcomes include identifying and defining database objects, using SQL, designing simple databases, and developing applications. The course modules cover topics such as conceptual modeling, the relational model, SQL, normalization, transactions, and recovery protocols. Required textbooks are also listed.
The document discusses database management systems (DBMS). It covers topics such as the introduction to databases, components of a DBMS, and applications of DBMS. It defines a DBMS as a system software used to create and manage databases. A DBMS provides users with tools to define, manipulate, retrieve, and manage data. It also discusses the different types of databases like hierarchical, network, relational, and object-oriented databases.
This document is a handbook on database systems authored by Muhammad Sharif. It contains 20 chapters covering topics like data types, data models, database design, normalization, transactions, and Oracle database fundamentals and administration. The handbook provides definitions of key database concepts such as structured vs unstructured data, records and files. It also describes the evolution of database systems from flat files to relational and object-oriented models. Different database architectures including client-server, parallel and distributed systems are explained.
Database system Handbook 3rd DONE Complete DBMS book Full book
dbms
rdbms
relational database systems handbook
database management systems and handbook
This document is a handbook on database systems authored by Muhammad Sharif. It contains 20 chapters covering topics like data types, data models, database design, normalization, transactions, query processing, indexing, security, backup and recovery. It discusses database concepts such as the different data architectures (single-tier, multi-tier, parallel, distributed), database management systems, data storage and the evolution of databases over time. The handbook aims to provide a comprehensive resource on relational database systems and their management.
4rth Complete book Database systems Handbook dbms rdbms by Muhammad Sharif
Database management systems handbook by Muhammad Sharif
#rdbms
dbms
database management systems handbook
database systems handbook
DBA book sql rdbms 4rth Complete book Database systems Handbook dbms rdbms by Muhammad Sharif
#Other names:
#DBMS
#RDBMS
#Relational database systems handbook
Database services management systems
The document discusses the components of a database management system (DBMS). It describes the main components as the DBMS software, hardware, data, procedures, database access language, and users. The software controls and manages the database. The hardware includes storage devices and computers. Data is the most important component, which is stored, updated, and retrieved from databases. Procedures provide instructions for using the DBMS. A database access language like SQL is used to interact with the data. Users include application programmers, database administrators, and end-users.
The document provides an introduction to database management systems. It discusses key concepts such as the purpose of DBMSs, data models, database languages, database design, storage and query processing. It also describes common DBMS components like the data dictionary and different types of database users. Overall, the document serves as a high-level overview of database management systems and lays the foundation for further exploration of topics within this domain.
The document provides an introduction to database management systems and their components. It discusses that a database is a collection of related data representing some aspect of the real world. A database management system (DBMS) allows users to define, construct, manipulate and share databases. The key functions of a DBMS include data definition, data storage, data manipulation such as querying and updating, and sharing data among multiple users. The document also provides examples of database systems and their typical components such as utilities, tools, and centralized and client/server architectures.
Pixel- A pixel, short for "picture element.pptxBINJAD1
A pixel, short for "picture element," is the smallest unit of a digital image or display. It is a tiny square or dot that represents a single point of color. When combined with other pixels, they form the images we see on screens, such as computer monitors, smartphones, and televisions.
Introduction to Computer Graphics or CG.pptBINJAD1
Computer graphics is an art of drawing pictures on computer screens with the help of programming. It involves computations, creation, and manipulation of data.
2D-Transformations-Transformations are the operations applied to geometrical ...BINJAD1
When a transformation takes place on a 2D plane, it is called 2D transformation. Transformations play an important role in computer graphics to reposition.
2D Viewing- the window by setting a two-dimensional viewing co-ordinate syst...BINJAD1
Two-dimension viewing in Computer graphics is a technique to map the world coordinates system (actual coordinates of the object in the real world) to device coordinates (actual coordinates of the object on the output screen like a monitor).
The internet and WWW-he terms World Wide Web (WWW) and the InternetBINJAD1
the World Wide Web is just one common area for information exchange, facilitated by global computer networks — or the Internet. You connect to this Internet to access the Web, but the Internet is just the connection between countless, separate servers, computers, and devices.
Introduction to object oriented programming.pptxBINJAD1
Object-Oriented Programming (OOP) is a programming paradigm that relies on the concept of Objects & Classes. With the help of this core principle, designing code and building software becomes much easier.
Sum of Product or SOP and Product of Sum or POS+ Karnaugh Map or K-Map .pptxBINJAD1
In this process, the information available in the form of a truth table or SOP (Sum of Product) form or POS (Product of Sum) form is expressed on the K-map.
Counters-Counter is a sequential circuit.pptxBINJAD1
Counter is a sequential circuit. A digital circuit which is used for a counting pulses is known counter. Counter is the widest application of flip-flops.
Linux is a Unix-like, open source and community-developed operating system (OS) for computers, servers, mainframes, mobile devices and embedded devices.
Tokens in php (php: Hypertext Preprocessor).pptxBINJAD1
In PHP a token is considered an individual component of a program. The keywords, variables, constants, operators and strings used in a program are tokens in PHP.
Introduction to PHP (Hypertext Preprocessor).pptxBINJAD1
PHP is a server-side scripting language created primarily for web development but it is also used as a general-purpose programming language. Unlike client-side languages like JavaScript, which are executed on the user’s browser, PHP scripts run on the server. The results are then sent to the client’s web browser as plain HTML.
The document provides an introduction to computers by defining what a computer is, describing its basic components and functions. It explains that a computer accepts data as input, processes it, produces output and stores results. The main components are the processor, memory, storage devices, input devices like keyboards and mice, and output devices like monitors and printers. It also discusses computer software, networks, the internet and how computers are used for electronic commerce.
This OrionX's 14th semi-annual report on the state of the cryptocurrency mining market. The report focuses on Proof-of-Work cryptocurrencies since those use substantial supercomputer power to mint new coins and encode transactions on their blockchains. Only two make the cut this time, Bitcoin with $18 billion of annual economic value produced and Dogecoin with $1 billion. Bitcoin has now reached the Zettascale with typical hash rates of 0.9 Zettahashes per second. Bitcoin is powered by the world's largest decentralized supercomputer in a continuous winner take all lottery incentive network.
Enabling BIM / GIS integrations with Other Systems with FMESafe Software
Jacobs has successfully utilized FME to tackle the complexities of integrating diverse data sources in a confidential $1 billion campus improvement project. The project aimed to create a comprehensive digital twin by merging Building Information Modeling (BIM) data, Construction Operations Building Information Exchange (COBie) data, and various other data sources into a unified Geographic Information System (GIS) platform. The challenge lay in the disparate nature of these data sources, which were siloed and incompatible with each other, hindering efficient data management and decision-making processes.
To address this, Jacobs leveraged FME to automate the extraction, transformation, and loading (ETL) of data between ArcGIS Indoors and IBM Maximo. This process ensured accurate transfer of maintainable asset and work order data, creating a comprehensive 2D and 3D representation of the campus for Facility Management. FME's server capabilities enabled real-time updates and synchronization between ArcGIS Indoors and Maximo, facilitating automatic updates of asset information and work orders. Additionally, Survey123 forms allowed field personnel to capture and submit data directly from their mobile devices, triggering FME workflows via webhooks for real-time data updates. This seamless integration has significantly enhanced data management, improved decision-making processes, and ensured data consistency across the project lifecycle.
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationChristine Shepherd
AI agents are reshaping logistics and supply chain operations by enabling automation, predictive insights, and real-time decision-making across key functions such as demand forecasting, inventory management, procurement, transportation, and warehouse operations. Powered by technologies like machine learning, NLP, computer vision, and robotic process automation, these agents deliver significant benefits including cost reduction, improved efficiency, greater visibility, and enhanced adaptability to market changes. While practical use cases show measurable gains in areas like dynamic routing and real-time inventory tracking, successful implementation requires careful integration with existing systems, quality data, and strategic scaling. Despite challenges such as data integration and change management, AI agents offer a strong competitive edge, with widespread industry adoption expected by 2025.
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Safe Software
Jacobs has developed a 3D utility solids modelling workflow to improve the integration of utility data into 3D Building Information Modeling (BIM) environments. This workflow, a collaborative effort between the New Zealand Geospatial Team and the Australian Data Capture Team, employs FME to convert 2D utility data into detailed 3D representations, supporting enhanced spatial analysis and clash detection.
To enable the automation of this process, Jacobs has also developed a survey data standard that standardizes the capture of existing utilities. This standard ensures consistency in data collection, forming the foundation for the subsequent automated validation and modelling steps. The workflow begins with the acquisition of utility survey data, including attributes such as location, depth, diameter, and material of utility assets like pipes and manholes. This data is validated through a custom-built tool that ensures completeness and logical consistency, including checks for proper connectivity between network components. Following validation, the data is processed using an automated modelling tool to generate 3D solids from 2D geometric representations. These solids are then integrated into BIM models to facilitate compatibility with 3D workflows and enable detailed spatial analyses.
The workflow contributes to improved spatial understanding by visualizing the relationships between utilities and other infrastructure elements. The automation of validation and modeling processes ensures consistent and accurate outputs, minimizing errors and increasing workflow efficiency.
This methodology highlights the application of FME in addressing challenges associated with geospatial data transformation and demonstrates its utility in enhancing data integration within BIM frameworks. By enabling accurate 3D representation of utility networks, the workflow supports improved design collaboration and decision-making in complex infrastructure projects
Developing Schemas with FME and Excel - Peak of Data & AI 2025Safe Software
When working with other team members who may not know the Esri GIS platform or may not be database professionals; discussing schema development or changes can be difficult. I have been using Excel to help illustrate and discuss schema design/changes during meetings and it has proven a useful tool to help illustrate how a schema will be built. With just a few extra columns, that Excel file can be sent to FME to create new feature classes/tables. This presentation will go thru the steps needed to accomplish this task and provide some lessons learned and tips/tricks that I use to speed the process.
Your startup on AWS - How to architect and maintain a Lean and Mean account J...angelo60207
Prevent infrastructure costs from becoming a significant line item on your startup’s budget! Serial entrepreneur and software architect Angelo Mandato will share his experience with AWS Activate (startup credits from AWS) and knowledge on how to architect a lean and mean AWS account ideal for budget minded and bootstrapped startups. In this session you will learn how to manage a production ready AWS account capable of scaling as your startup grows for less than $100/month before credits. We will discuss AWS Budgets, Cost Explorer, architect priorities, and the importance of having flexible, optimized Infrastructure as Code. We will wrap everything up discussing opportunities where to save with AWS services such as S3, EC2, Load Balancers, Lambda Functions, RDS, and many others.
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMAnchore
Over 70% of any given software application consumes open source software (most likely not even from the original source) and only 15% of organizations feel confident in their risk management practices.
With the newly announced Anchore SBOM feature, teams can start safely consuming OSS while mitigating security and compliance risks. Learn how to import SBOMs in industry-standard formats (SPDX, CycloneDX, Syft), validate their integrity, and proactively address vulnerabilities within your software ecosystem.
Artificial Intelligence in the Nonprofit Boardroom.pdfOnBoard
OnBoard recently partnered with Microsoft Tech for Social Impact on the AI in the Nonprofit Boardroom Survey, an initiative designed to uncover the current and future role of artificial intelligence in nonprofit governance.
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Anish Kumar
Presented by: Anish Kumar
LinkedIn: https://www.linkedin.com/in/anishkumar/
This lightning talk dives into real-world GenAI projects that scaled from prototype to production using Databricks’ fully managed tools. Facing cost and time constraints, we leveraged four key Databricks features—Workflows, Model Serving, Serverless Compute, and Notebooks—to build an AI inference pipeline processing millions of documents (text and audiobooks).
This approach enables rapid experimentation, easy tuning of GenAI prompts and compute settings, seamless data iteration and efficient quality testing—allowing Data Scientists and Engineers to collaborate effectively. Learn how to design modular, parameterized notebooks that run concurrently, manage dependencies and accelerate AI-driven insights.
Whether you're optimizing AI inference, automating complex data workflows or architecting next-gen serverless AI systems, this session delivers actionable strategies to maximize performance while keeping costs low.
Mastering AI Workflows with FME - Peak of Data & AI 2025Safe Software
Harness the full potential of AI with FME: From creating high-quality training data to optimizing models and utilizing results, FME supports every step of your AI workflow. Seamlessly integrate a wide range of models, including those for data enhancement, forecasting, image and object recognition, and large language models. Customize AI models to meet your exact needs with FME’s powerful tools for training, optimization, and seamless integration
Providing an OGC API Processes REST Interface for FME FlowSafe Software
This presentation will showcase an adapter for FME Flow that provides REST endpoints for FME Workspaces following the OGC API Processes specification. The implementation delivers robust, user-friendly API endpoints, including standardized methods for parameter provision. Additionally, it enhances security and user management by supporting OAuth2 authentication. Join us to discover how these advancements can elevate your enterprise integration workflows and ensure seamless, secure interactions with FME Flow.
Kubernetes Security Act Now Before It’s Too LateMichael Furman
In today's cloud-native landscape, Kubernetes has become the de facto standard for orchestrating containerized applications, but its inherent complexity introduces unique security challenges. Are you one YAML away from disaster?
This presentation, "Kubernetes Security: Act Now Before It’s Too Late," is your essential guide to understanding and mitigating the critical security risks within your Kubernetes environments. This presentation dives deep into the OWASP Kubernetes Top Ten, providing actionable insights to harden your clusters.
We will cover:
The fundamental architecture of Kubernetes and why its security is paramount.
In-depth strategies for protecting your Kubernetes Control Plane, including kube-apiserver and etcd.
Crucial best practices for securing your workloads and nodes, covering topics like privileged containers, root filesystem security, and the essential role of Pod Security Admission.
Don't wait for a breach. Learn how to identify, prevent, and respond to Kubernetes security threats effectively.
It's time to act now before it's too late!
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2025/06/solving-tomorrows-ai-problems-today-with-cadences-newest-processor-a-presentation-from-cadence/
Amol Borkar, Product Marketing Director at Cadence, presents the “Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor” tutorial at the May 2025 Embedded Vision Summit.
Artificial Intelligence is rapidly integrating into every aspect of technology. While the neural processing unit (NPU) often receives the majority of the spotlight as the ultimate AI problem solver, it is essential to recognize that not all AI workloads can be efficiently executed on an NPU and that neural network architectures are evolving rapidly. To create efficient chips and systems with market longevity, designers must plan for diverse AI workloads that include networks yet to be invented.
In this presentation, Borkar introduces a new processor from Cadence Tensilica. This new solution is designed to complement any NPU, creating the perfect synergy between the two processing engines and establishing a robust AI subsystem able to efficiently support workloads yet to be encountered. This combination allows developers to achieve efficiency and performance on the AI workloads of today and tomorrow, paving the way for future innovations in AI-powered devices.
2. 1.0 What is Data?
• In simple words, data can be facts related to
any object in consideration.
• For example, your name, age, height, weight,
etc. are some data related to you.
• A picture, image, file, pdf, etc. can also be
considered data.
3. 1.0 What is Data? …
• We all are familiar with Social websites like Facebook & Instagram,
E-Commerce websites like Amazon & SnapDeal, Banking websites
like Barclays & HDFC or any Education website like ToolsQA, all
these websites have a humongous amount of data stored in it.
• So what is Data?
• Data is any sort of information which is stored in computer
memory.
• This information can later be used for a website, an application or any
other client to store for future purpose.
• The most common information is User information in the form of user
personal, address and banking information.
4. 1.0 What is Data? …
• Let’s consider Facebook, it stores our personal data, images, posts, comments
and many more things.
• Banking application also stores user data, their transactions details, funds summary etc.
• All this information is data, but when it put together and store in a structural
way, it becomes informational data.
• But, how do these applications or websites get data?
• When you post a status on Facebook, perform a banking transaction online or upload a
selfie on Instagram, you are actually sending data to the site or to be precise their server.
• So, we can say any information transmitted or transferred is actually data.
• Server filter out the necessary data and stores it in Database (DB).
5. 1.1 Data, Information, and Knowledge
• Data are the raw bits and pieces of information with no context.
• If I told you, “15, 23, 14, 85,” you would not have learned anything.
• But I would have given you data.
• Data can be quantitative or qualitative.
• Quantitative data is numeric, the result of a measurement, count, or some other
mathematical calculation.
• Qualitative data is descriptive. “Ruby Red,” the color of a 2013 Ford Focus, is an
example of qualitative data.
• A number can be qualitative too: if I tell you my favorite number is 5, that is
qualitative data because it is descriptive, not the result of a measurement or
mathematical calculation.
7. 1.1 Data, Information, and Knowledge…
• By itself, data is not that useful.
• To be useful, it needs to be given context.
• Returning to the example above, if I told you that “15, 23, 14, and 85″ are the numbers of students that had
registered for upcoming classes, that would be information.
• By adding the context – that the numbers represent the count of students registering for specific classes – I have
converted data into information.
• Once we have put our data into context, aggregated and analyzed it, we can use it to make decisions for our
organization.
• We can say that this consumption of information produces knowledge.
• This knowledge can be used to make decisions, set policies, and even spark innovation.
• The final step up the information ladder is the step from knowledge (knowing a lot about a topic) to wisdom.
• We can say that someone has wisdom when they can combine their knowledge and experience to produce a deeper
understanding of a topic.
• It often takes many years to develop wisdom on a particular topic, and requires patience.
8. 1.1 Examples of Data
• Almost all software programs require data to do anything useful.
• For example, if you are editing a document in a word processor such
as Microsoft Word, the document you are working on is the data.
• The word-processing software can manipulate the data: create a
new document, duplicate a document, or modify a document.
• Some other examples of data are: an MP3 music file, a video file, a
spreadsheet, a web page, and an e-book.
• In some cases, such as with an e-book, you may only have the ability
to read the data.
9. 1.2 What is a Database (DB) ?
• The goal of many information systems is to transform data into information in order to generate
knowledge that can be used for decision making.
• In order to do this, the system must be able to take data, put the data into context, and provide tools for
aggregation and analysis.
• A database is designed for just such a purpose.
• A database is an organized collection of related information.
• It is an organized collection, because in a database, all data is described and associated with other data.
• All information in a database should be related as well; separate databases should be created to
manage unrelated information.
• For example, a database that contains information about students should not also hold information
about company stock prices.
• Databases are not always digital – a filing cabinet, for instance, might be considered a form of database.
• For the purposes of this text, we will only consider digital databases.
10. 1.2 What is a Database (DB) ?…
• A database is a systematic collection of data.
• They support electronic storage and manipulation of data.
• Databases make data management easy.
• Let us discuss a few examples:
• An online telephone directory uses a database to store data of people, phone numbers, other contact
details.
• Your electricity service provider uses a database to manage billing, client-related issues, handle fault
data, etc.
• Let us also consider Facebook.
• It needs to store, manipulate, and present data related to members, their friends, member activities,
messages, advertisements, and a lot more.
• We can provide a countless number of examples for the usage of databases.
11. 1.2 What is a Database (DB) ?…
• So what is a Database?
• Is it a random collection of stuff all squeezed in together?
• No, Database (DB) are organized, they have a structure, and all the data they store it fits
into that structure.
• More specifically, a database is an electronic system that allows data to be stored, easily
accessed, manipulated and updated.
• So, we just saw the definition of databases but where in real life can we see such things?
• Well, we all are well aware of things like a telephone directory.
• Well, phonebook/telephone directory actually contains the name of people arranged in
order of their last names.
• So, we are able to store data and search it efficiently using the last name of the person, like
it’s really easy if I ask you to search for Tyagi, Vishu.
12. 1.2 What is a Database (DB) ?…
• But an issue arrives if I ask you to search for every contact with the first name Martin.
• The issue here is, names are stored according to last names so searching for the first name is a lot trickier.
• So, a database is made up of two components mainly, data and a meaningful method for accessing and manipulating data.
• Without these two, a database is just a random set of data.
• A more precise example of a database can be a dictionary, which stores a large quantity of data as Key-Value pairs.
• At the same time, it also has a meaningful method to access data using the Key.
• Databases are quite similar to spreadsheets as they are mostly made up of tables which contain rows and columns like a
spreadsheet.
• A database needs to be hosted or created on some special database platform, some of the famous Database platforms are:
• PostgreSQL
• MySQL
• Microsoft Access
• SQLite
• We know that when we use any software, like an app, data is either added to the database, updated according to the
action or pulled as per the action we perform.
• But, the computer must have something to perform such action too.
• A software which can perform the various operations on databases is known as Database Management System (DBMS).
13. 1.2 What is a Database (DB) ?…
• As the name suggests, a database is a place where all the data gets stored in a
structured format.
• It helps the users to easily access, manage and update the required information.
• So, in layman terms you can understand, a database as a big container wherein all the
information about a website, or an application is stored in a structured format.
• For example, a company can have various details of employees, such as name,
empID, email, blood group, salary, and so on.
• All these details can be stored in a database with the name “Employee” in a structured
format such as tables, hierarchy, etc.
• In any organization, be it a startup or a hyper-growth company, many
databases can be present, but it is very important to manage those databases
in a proper manner.
• So, next in this article let us understand how to manage these databases.
14. 2.0 Database Management Systems (DBMS)
• There is no doubt in the fact that humongous amounts of
data get generated on a daily basis from various
applications, business sites in different formats.
• But, how do you think, we can handle data present in
various formats and generate useful insights.
• Well, to do that, we need the database management
systems(DBMS).
15. 2.1 What is DBMS ? …
• DBMS or Database Management
System is a software application used
to access, create, and manage
databases.
• With the help of DBMS, you can easily
create, retrieve and update data in
databases.
• A DBMS consists of a group of
commands to manipulate the database
and acts as an interface between the
end-users and the database.
16. 2.1 What is DBMS? …
• Database Management Systems also aims to facilitate an overview of the databases, by
providing a variety of administrative operations such as tuning, performance
monitoring, and backup recovery.
• Database Management Systems allows users to do the following:
Define Data – Allows the users to create, modify and delete the definitions which define
the organization of the database.
Update Data – Provides access to the users to insert, modify and delete data from the
database.
Retrieve Data – Allows the users to retrieve data from the database based on the
requirement.
Administration of users – Registers the users and monitors their action, enforces data
security, maintains data integrity, monitors performance and deals with concurrency
control.
17. 2.2 Example of a DBMS
• Let us see a simple example of a university database.
• This database is maintaining information concerning students, courses, and grades in a university
environment.
• The database is organized as five files:
The STUDENT file stores data of each student
The COURSE file stores contain data on each course.
The SECTION stores the information about sections in a particular course.
The GRADE file stores the grades which students receive in the various sections
The TUTOR file contains information about each professor.
• To define a database system:
o We need to specify the structure of the records of each file by defining the different types of data
elements to be stored in each record.
o We can also use a coding scheme to represent the values of a data item.
o Basically, your Database will have 5 tables with a foreign key defined amongst the various tables.
18. 2.3 History of DBMS
• Here, are the important landmarks from the history:
1960 - Charles Bachman designed first DBMS system
1970 - Codd introduced IBM'S Information Management System (IMS)
1976- Peter Chen coined and defined the Entity-relationship model also know as the ER model
1980 - Relational Model becomes a widely accepted database component
1985- Object-oriented DBMS develops.
1990s- Incorporation of object-orientation in relational DBMS.
1991- Microsoft ships MS access, a personal DBMS and that displaces all other personal DBMS
products.
1995: First Internet database applications
1997: XML applied to database processing. Many vendors begin to integrate XML into DBMS
products.
19. 2.4 Characteristics of DBMS
• The following are a few characteristics of DBMS:
Provides security and removes redundancy
Self-describing nature of a database system
Insulation between programs and data abstraction
Support of multiple views of the data
Sharing of data and multiuser transaction processing
DBMS allows entities and relations among them to form tables.
It follows the ACID concept (Atomicity, Consistency, Isolation, and Durability).
DBMS supports multi-user environment that allows users to access and
manipulate data in parallel.
20. 2.4 DBMS vs. Flat File
DBMS Flat File Management
System
• Multi-user access • It does not support
multi-user access
• Design to fulfill the need
for small and large
businesses
• It is only limited to
smaller DBMS system.
• Remove redundancy and
Integrity
• Redundancy and
Integrity issues
21. 2.5 Users in a DBMS environment
Component
Name
Task
Application
Programmers
• The Application programmers write
programs in various programming
languages to interact with databases.
Database
Administrators
• Database Admin is responsible for
managing the entire DBMS system.
• He/She is called Database admin or
DBA.
End-Users • The end users are the people who
22. 2.6 Popular DBMS Software
• Here, is the list of some popular DBMS system:
MySQL
Microsoft Access
Oracle
PostgreSQL
dBASE
FoxPro
SQLite
IBM DB2
LibreOffice Base
MariaDB
Microsoft SQL Server etc.
23. 2.7 Application of DBMS
Sector Use of DBMS
Banking •For customer information, account activities, payments,
deposits, loans, etc.
Airlines •For reservations and schedule information.
Universitie
s
•For student information, course registrations, colleges
and grades.
Telecommu
nication
•It helps to keep call records, monthly bills, maintaining
balances, etc.
Finance •For storing information about stock, sales, and
purchases of financial instruments like stocks and
bonds.
24. 2.8 Types of DBMS
• Four Types of DBMS systems are:
Hierarchical database
Network database
Relational database
Object-Oriented database
25. 2.8 Types of DBMS
1) Hierarchical DBMS
• In a Hierarchical database, model data is organized in a tree-like structure.
• Data is Stored Hierarchically (top down or bottom up) format.
• Data is represented using a parent-child relationship.
• In Hierarchical DBMS parent may have many children, but children have only one
parent.
2) Network Model
• The network database model allows each child to have multiple parents.
• It helps you to address the need to model more complex relationships like as the
orders/parts many-to-many relationship.
• In this model, entities are organized in a graph which can be accessed through several
paths.
26. 2.8 Types of DBMS
3) Relational model
• Relational DBMS is the most widely used DBMS model because it is one of the
easiest.
• This model is based on normalizing data in the rows and columns of the tables.
• Relational model stored in fixed structures and manipulated using SQL.
4) Object-Oriented Model
• In Object-oriented Model data stored in the form of objects.
• The structure which is called classes which display data within it.
• It defines a database as a collection of objects which stores both data members
values and operations.
27. 2.9 Advantages of DBMS
DBMS offers a variety of techniques to store & retrieve data
DBMS serves as an efficient handler to balance the needs of multiple applications
using the same data
Uniform administration procedures for data
Application programmers never exposed to details of data representation and storage.
A DBMS uses various powerful functions to store and retrieve data efficiently.
Offers Data Integrity and Security
The DBMS implies integrity constraints to get a high level of protection against
prohibited access to data.
A DBMS schedules concurrent access to the data in such a manner that only one user
can access the same data at a time
Reduced Application Development Time
28. 2.10 Disadvantages of DBMS
Cost of Hardware and Software of a DBMS is quite high which
increases the budget of your organization.
Most database management systems are often complex systems, so
the training for users to use the DBMS is required.
In some organizations, all data is integrated into a single database
which can be damaged because of electric failure or database is
corrupted on the storage media
Use of the same program at a time by many users sometimes lead
to the loss of some data.
DBMS can't perform sophisticated calculations
29. 2.11 When not to use a DBMS system?
• Although, DBMS system is useful.
• It is still not suited for specific task mentioned below:
• Not recommended when you do not have the budget or
the expertise to operate a DBMS.
• In such cases, Excel/CSV/Flat Files could do just fine.
30. 3.0 DDL, DML, DCL, and TCL Commands
• Structured Query Language(SQL) as we all know is the database language by
the use of which we can perform certain operations on the existing database
and also we can use this language to create a database.
• SQL uses certain commands like Create, Drop, Insert etc. to carry out the
required tasks.
• These SQL commands are mainly categorized into four categories as:
1) DDL – Data Definition Language
2) DML – Data Manipulation Language
3) DCL – Data Control Language
4) TCL – Transaction Control Language
32. 3.1 DDL Commands
• DDL is short name of Data Definition Language, which deals with database
schemas and descriptions, of how the data should reside in the database.
CREATE - to create a database and its objects like (table, index, views, store
procedure, function, and triggers)
ALTER - alters the structure of the existing database
DROP - delete objects from the database
TRUNCATE - remove all records from a table, including all spaces allocated
for the records are removed
COMMENT - add comments to the data dictionary
RENAME - rename an object
33. 3.1 DDL Commands : Creating a Database
• To create a database in RDBMS, create command is used.
• Following is the syntax,
• Example for creating Database
• The above command will create a database named Test, which will
be an empty schema without any table.
• To create tables in this newly created database, we can again use the
create command.
CREATE DATABASE <DB_NAME>;
CREATE DATABASE Test;
34. 3.1 DDL Commands : Creating a Table
• Create command can also be used to create tables.
• Now when we create a table, we have to specify the details of the columns of the tables too.
• We can specify the names and datatypes of various columns in the create command itself.
• Following is the syntax,
• Create table command will tell the database system to create a new table with the given table name
and column information.
CREATE TABLE <TABLE_NAME>
(
column_name1 datatype1,
column_name2 datatype2,
column_name3 datatype3,
column_name4 datatype4
);
35. creating Table
• The above command will create a new table with name
Student in the current database with 3 columns, namely
student_id, name and age.
• Where the column student_id will only store integer, name
will hold upto 100 characters and age will again store only
integer value.
CREATE TABLE Student
(
student_id INT,
name VARCHAR(100),
age INT
);
36. Table …
• If you are currently not logged into your database in which you want to create
the table then you can also add the database name along with table name,
using a dot operator .
• For example, if we have a database with name Test and we want to create a
table Student in it, then we can do so using the following query:
CREATE TABLE Test.Student
(
student_id INT,
name VARCHAR(100),
age INT
);
37. 3.1 DDL Commands : Most commonly used datatypes for
Table columns
Dataty
pe
Use
INT used for columns which will store integer values.
FLOAT used for columns which will store float values.
DOUBL
E
used for columns which will store float values.
VARCH
AR
used for columns which will be used to store
characters and integers, basically a string.
CHAR used for columns which will store char
38. 3.2 DDL Commands : ALTER command
• alter command is used for altering the table structure, such
as,
to add a column to existing table
to rename any existing column
to change datatype of any column or to
modify its size.
to drop a column from the table.
39. 3.2 DDL Commands : ALTER command : Add a new
Column
• Using ALTER command we can add a column to any existing table.
• Following is the syntax,
• Here is an Example for this,
• The above command will add a new column address to the table student, which will hold
data of type varchar which is nothing but string, of length 200.
ALTER TABLE table_name ADD
(
column_name datatype
);
ALTER TABLE student ADD
(
address VARCHAR(200)
);
40. 3.2 DDL Commands : ALTER command : Add multiple
new Columns
• Using ALTER command we can even add multiple new columns to any existing table.
• Following is the syntax,
• Here is an Example for this,
• The above command will add three new columns to the student table.
ALTER TABLE table_name ADD
(
column_name1 datatype1,
column-name2 datatype2,
column-name3 datatype3
);
ALTER TABLE student ADD
(
father_name VARCHAR(60),
mother_name VARCHAR(60),
dob DATE
);
41. 3.2 DDL Commands : ALTER command : Add Column with
default value
• ALTER command can add a new column to an existing table with a default value too.
• The default value is used when no value is inserted in the column.
• Following is the syntax,
• Here is an Example for this,
• The above command will add a new column with a preset default value to the table student.
ALTER TABLE table_name ADD
(
column-name1 datatype1 DEFAULT some_value
);
ALTER TABLE student ADD
(
dob DATE DEFAULT '01-Jan-99'
);
42. 3.2 DDL Commands : ALTER command : Modify an
existing Column
• ALTER command can also be used to modify data type of any existing column.
• Following is the syntax,
• Here is an Example for this,
• Remember we added a new column address in the beginning?
• The above command will modify the address column of the student table, to now hold up to 300 characters.
ALTER TABLE table_name modify
(
column_name datatype
);
ALTER TABLE student MODIFY
(
address varchar(300)
);
43. 3.2 DDL Commands : ALTER command : Rename a
Column
• Using ALTER command you can rename an existing column.
• Following is the syntax,
• Here is an example for this,
• The above command will rename address column to location.
ALTER TABLE table_name RENAME
old_column_name TO new_column_name;
ALTER TABLE student RENAME
address TO location;
44. 3.2 DDL Commands : ALTER command : Drop a Column
• ALTER command can also be used to drop or remove columns.
• Following is the syntax,
• Here is an example for this,
• The above command will drop the address column from the table student.
ALTER TABLE table_name DROP
(
column_name
);
ALTER TABLE student DROP
(
address
);
45. Rename a Table
TRUNCATE command
• TRUNCATE command removes all the records from a table.
• But this command will not destroy the table's structure.
• When we use TRUNCATE command on a table its (auto-increment) primary key is also initialized.
• Following is its syntax,
• Here is an example explaining it,
• The above query will delete all the records from the table student.
• In DML commands, we will study about the DELETE command which is also more or less
same as the TRUNCATE command.
TRUNCATE TABLE table_name
TRUNCATE TABLE student;
46. 3.3 DDL Commands : DROP command
• DROP command completely removes a table from the database.
• This command will also destroy the table structure and the data stored in it.
• Following is its syntax,
• Here is an example explaining it,
• The above query will delete the Student table completely.
• It can also be used on Databases, to delete the complete database.
• For example, to drop a database,
• The above query will drop the database with name Test from the system.
DROP TABLE table_name
DROP TABLE student;
DROP DATABASE Test;
47. 3.3 DDL Commands : RENAME query
• RENAME command is used to set a new name for any
existing table.
• Following is the syntax,
• Here is an example explaining it.
• The above query will rename the table student to
students_info
RENAME TABLE old_table_name to new_table_name
RENAME TABLE student to students_info;
48. 3.4 SQL: Comments
• Comments are used to explain sections of SQL statements, or
to prevent execution of SQL statements.
• These comments can appear on a single line or span across
multiple lines.
• There are two types that you can use to create a comment in
SQL.
1. Single Line Comment (- -)
2. Multiple Lines Comment (/* */)
49. 3.4 SQL: Comments : Single Line Comment (- -)
Syntax Using -- symbol
• The syntax for creating a SQL comment using the -- symbol in SQL
Server is:
Example - Comment on a Single Line
-- comment goes here
SELECT employee_id, last_name -- Author: MMC MNTDY
FROM employees;
50. (/* */)
Syntax Using /* and */ symbols
• The syntax for creating a SQL comment using /* and */
symbols in SQL Server (Transact-SQL) is:
• In SQL Server, a comment that starts with /* symbol and
ends with */ and can be anywhere in your SQL statement.
• This method of commenting can span several lines within
your SQL.
/* comment goes here */
51. (/* */) …
Example - Comment on a Multiple Lines
• Let's look at a SQL comment example that shows a SQL comment on its own
line:
• Here is a SQL comment that appears in the middle of the line:
• Here is a SQL comment that appears at the end of the line:
SELECT employee_id, last_name
/* Author: MMC MNTDY*/
FROM employees;
SELECT /* Author: MMC MNTDY*/
employee_id, last_name
FROM employees;
SELECT employee_id, last_name
/* Author: MMC MNTDY
Purpose: To show a comment that spans multiple lines in your SQL statement.
*/
FROM employees;
52. 4.0 DML Commands
• DML is short name of Data Manipulation Language which deals with data manipulation
and includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE, etc.,
and it is used to store, modify, retrieve, delete and update data in a database.
SELECT - retrieve data from a database
INSERT - insert data into a table
UPDATE - updates existing data within a table
DELETE - Delete all records from a database table
MERGE - UPSERT operation (insert or update)
CALL - call a PL/SQL or Java subprogram
EXPLAIN PLAN - interpretation of the data access path
LOCK TABLE - concurrency Control
53. command
• Data Manipulation Language (DML) statements are used for
managing data in database.
• DML commands are not auto-committed.
• It means changes made by DML command are not
permanent to database, it can be rolled back.
• Talking about the Insert command, whenever we post a
Tweet on Twitter, the text is stored in some table, and as we
post a new tweet, a new record gets inserted in that table.
54. command…
• Insert command is used to insert data into a table.
• Following is its general syntax,
• Lets see an example,
• Consider a table student with the following fields.
• The above command will insert a new record into student table.
INSERT INTO table_name VALUES(data1, data2, ...)
s_id name age
INSERT INTO student VALUES(101, 'Adam', 15);
s_id name age
101 Adam 15
55. 4.1 DML Commands : Insert value into only specific
columns
• We can use the INSERT command to insert values for only
some specific columns of a row.
• We can specify the column names along with the values to
be inserted like this,
• The above SQL query will only insert id and name values in
the newly inserted record.
INSERT INTO student(id, name) values(102, 'Alex');
56. 4.1 DML Commands : Insert NULL value to a
column
• Both the statements below will insert NULL value into age
column of the student table.
Or,
• The above command will insert only two column values and
the other column is set to null.
INSERT INTO student(id, name) values(102, 'Alex');
INSERT INTO Student VALUES(102,'Alex', null);
S_id S_Name age
101 Adam 15
102 Alex
57. 4.1 DML Commands : Insert Default value to a
column
• Suppose the column age in our tabel has a default value of 14.
• Also, if you run the below query, it will insert default value into the age column, whatever
the default value may be.
INSERT INTO Student VALUES(103,'Chris', default)
INSERT INTO Student VALUES(103,'Chris')
S_id S_Name age
101 Adam 15
102 Alex
103 chris 14
58. 4.2 DML Commands : SELECT SQL Query
• SELECT query is used to retrieve data from a table.
• It is the most used SQL query.
• We can retrieve complete table data, or partial by specifying conditions using
the WHERE clause.
Syntax of SELECT query
• SELECT query is used to retieve records from a table.
• We can specify the names of the columns which we want in the resultset.
SELECT
column_name1,
column_name2,
column_name3,
...
column_nameN
FROM table_name;
59. 4.2 DML Commands : SELECT SQL Query
Time for an Example : Consider the following student table,
• The above query will fetch information of s_id, name and age columns of the student table
and display them,
• As you can see the data from address column is absent, because we did not specif it in our SELECT query.
SELECT s_id, name, age FROM student;
s_id name age address
101 Adam 15 Chennai
102 Alex 18 Delhi
103 Abhi 17 Banglore
104 Ankit 22 Mumbai
s_id Name age
101 Adam 15
102 Alex 18
103 Abhi 17
104 Ankit 22
60. 4.2 DML Commands : SELECT SQL Query - Select all records from a
table
• A special character asterisk * is used to address all the data(belonging to all
columns) in a query.
• SELECT statement uses * character to retrieve all records from a table, for all
the columns.
• The above query will show all the records of student table, that means it will
show complete dataset of the table.
SELECT * FROM student;
s_id name age address
101 Adam 15 Chennai
102 Alex 18 Delhi
103 Abhi 17 Banglore
104 Ankit 22 Mumbai
61. 4.2 DML Commands : SELECT SQL Query - Select a particular record based on a
condition
• We can use the WHERE clause to set a condition,
• The above query will return the following result,
SELECT * FROM student WHERE name = 'Abhi';
103 Abhi 17 Banglore
62. 4.2 DML Commands : SELECT SQL Query - Performing Simple Calculations
using SELECT Query
• Consider the following employee table.
• Here is our SELECT query,
• The above command will display a new column in the result, with 3000 added into existing salaries of the employees.
• So you can also perform simple mathematical operations on the data too using the SELECT query to fetch data from table.
SELECT eid, name, salary+3000 FROM employee;
eid name age salary
101 Adam 26 5000
102 Ricky 42 8000
103 Abhi 25 10000
104 Rohan 22 5000
eid name salary+3000
101 Adam 8000
102 Ricky 11000
103 Abhi 13000
104 Rohan 8000
63. 4.3 DML Commands : Using UPDATE SQL command
• Let's take an example of a real-world problem.
• These days, Facebook provides an option for Editing your status
update, how do you think it works?
• Yes, using the Update SQL command.
• Let's learn about the syntax and usage of the UPDATE command.
• UPDATE command is used to update any record of data in a table.
• Following is its general syntax,
• WHERE is used to add a condition to any SQL query.
UPDATE table_name SET column_name = new_value WHERE some_condition;
64. 4.3 DML Commands : Using UPDATE SQL command
…
• Lets take a sample table student,
• In the above statement, if we do not use the WHERE clause, then our update
query will update age for all the columns of the table to 18.
UPDATE student SET age=18 WHERE student_id=102;
student_id name age
101 Adam 15
102 Alex
103 chris 14
S_id S_Name age
101 Adam 15
102 Alex 18
103 chris 14
65. 4.3 DML Commands : Using UPDATE SQL command
…
Updating Multiple Columns
• We can also update values of multiple columns using a
single UPDATE statement.
• The above command will update two columns of the record
which has s_id 103.
UPDATE student SET name='Abhi', age=17 where s_id=103;
s_id name age
101 Adam 15
102 Alex 18
103 Abhi 17
66. 4.3 DML Commands : Using UPDATE SQL command
…
Incrementing Integer Value
• When we have to update any integer value in a table, then we can
fetch and update the value in the table in a single statement.
• For example, if we have to update the age column of student table
every year for every student, then we can simply run the following
UPDATE statement to perform the following operation:
• As you can see, we have used age = age + 1 to increment the value of
age by 1.
• NOTE: This style only works for integer values.
UPDATE student SET age = age+1;
67. 4.4 DML Commands : Using DELETE SQL command
• When you ask any question in Study tonight's Forum it gets saved into a
table.
• And using the Delete option, you can even delete a question asked by
you.
• How do you think that works?
• Yes, using the Delete DML command.
• Let's study about the syntax and the usage of the Delete command.
• DELETE command is used to delete data from a table.
• Following is its general syntax,
DELETE FROM table_name;
68. 4.4 DML Commands : Using DELETE SQL command
…
• Let's take a sample table student:
Delete all Records from a Table
• The above command will delete all the records from the
table student.
DELETE FROM student;
s_id name age
101 Adam 15
102 Alex 18
103 Abhi 17
69. 4.4 DML Commands : Using DELETE SQL command
…
Delete a particular Record from a Table
• In our student table if we want to delete a single record, we
can use the WHERE clause to provide a condition in our
DELETE statement.
• The above command will delete the record where s_id is 103
from the table student.
DELETE FROM student WHERE s_id=103;
70. 4.4 DML Commands : Using DELETE SQL command
…
Isn't DELETE same as TRUNCATE
• TRUNCATE command is different from DELETE command.
• The delete command will delete all the rows from a table whereas truncate
command not only deletes all the records stored in the table, but it also re-
initializes the table(like a newly created table).
• For eg: If you have a table with 10 rows and an auto_increment primary key,
and if you use DELETE command to delete all the rows, it will delete all the
rows, but will not re-initialize the primary key, hence if you will insert any
row after using the DELETE command, the auto_increment primary key will
start from 11.
• But in case of TRUNCATE command, primary key is re-initialized, and it will
again start from 1.
71. 5.0 TCL Commands
• Transaction Control Language(TCL) commands are used to manage
transactions in the database.
• These are used to manage the changes made to the data in a table
by DML statements.
• It also allows statements to be grouped together into logical
transactions
• These are-
Commit,
Rollback and
Savepoint
72. 5.1 TCL Commands : COMMIT command
• COMMIT command is used to permanently save any transaction
into the database.
• When we use any DML command like INSERT, UPDATE or DELETE, the
changes made by these commands are not permanent, until the current
session is closed, the changes made by these commands can be rolled back.
• To avoid that, we use the COMMIT command to mark the changes
as permanent.
• Following is commit command's syntax,
COMMIT;
73. 5.2 TCL Commands : SAVEPOINT command…
• SAVEPOINT command is used to temporarily save a transaction so
that you can rollback to that point whenever required.
• Following is savepoint command's syntax,
• In short, using this command we can name the different states of
our data in any table and then rollback to that state using the
ROLLBACK command whenever required.
SAVEPOINT savepoint_name;
74. 5.3 TCL Commands : ROLLBACK command
• This command restores the database to last commited state.
• It is also used with SAVEPOINT command to jump to a savepoint in an ongoing
transaction.
• If we have used the UPDATE command to make some changes into the
database, and realise that those changes were not required, then we can use
the ROLLBACK command to rollback those changes, if they were not
commited using the COMMIT command.
• Following is rollback command's syntax,
ROLLBACK TO savepoint_name;
75. 5.4 TCL Commands : Examples
Using Savepoint and Rollback
• Following is the table class,
• Lets use some SQL queries on the above table and see the results.
id name
1 Abhi
2 Arunima
4 Alex
INSERT INTO class VALUES(5, 'Rahul');
COMMIT;
UPDATE class SET name = 'Abhijit' WHERE id = '5';
SAVEPOINT A;
INSERT INTO class VALUES(6, ‘Ameya');
SAVEPOINT B;
INSERT INTO class VALUES(7, 'Bravo');
SAVEPOINT C;
SELECT * FROM class;
76. 5.4 TCL Commands : Examples …
• NOTE: SELECT statement is used to show the data stored in the table.
• The resultant table will look like,
id name
1 Abhi
2 Arunima
4 Alex
5 Abhijit
6 Ameya
7 Bravo
77. 5.4 TCL Commands : Examples …
• Now let's use the ROLLBACK command to roll back the state of data to the
savepoint B.
• Now our class table will look like,
ROLLBACK TO B;
SELECT * FROM class;
id name
1 Abhi
2 Arunima
4 Alex
5 Abhijit
6 Ameya
78. 5.4 TCL Commands : Examples …
• Now let's again use the ROLLBACK command to roll back the state of data to
the savepoint A
• Now the table will look like,
ROLLBACK TO A;
SELECT * FROM class;
id name
1 Abhi
2 Arunima
4 Alex
5 Abhijit
79. 4.3 Using the WHERE SQL clause
• WHERE clause is used to specify/apply any condition while retrieving, updating or
deleting data from a table.
• This clause is used mostly with SELECT, UPDATE and DELETE query.
• When we specify a condition using the WHERE clause then the query executes only
for those records for which the condition specified by the WHERE clause is true.
Syntax for WHERE clause
• Here is how you can use the WHERE clause with a DELETE statement, or any other
statement,
• The WHERE clause is used at the end of any SQL query, to specify a condition for
execution.
DELETE FROM table_name WHERE [condition];
80. 4.3 Using the WHERE SQL clause …
• Time for an Example : Consider a table student,
• Now we will use the SELECT statement to display data of the table, based on a condition,
which we will add to our SELECT query using WHERE clause.
• Let's write a simple SQL query to display the record for student with s_id as 101.
• Following will be the result of the above query.
SELECT s_id, name, age, address
FROM student WHERE s_id = 101;
s_id name age address
101 Adam 15 Chennai
102 Alex 18 Delhi
103 Abhi 17 Banglore
104 Ankit 22 Mumbai
s_id name age address
101 Adam 15 Noida
81. 4.3 Using the WHERE SQL clause …
Applying condition on Text Fields
• In the above example we have applied a condition to an integer value field,
but what if we want to apply the condition on name field.
• In that case we must enclose the value in single quote ' ‘.
• Some databases even accept double quotes, but single quotes is accepted by
all.
• Following will be the result of the above query.
SELECT s_id,
name,
age,
address
FROM student WHERE name = 'Adam';
s_id name age address
101 Adam 15 Noida
82. 4.3 Using the WHERE SQL clause: Operators for WHERE
clause condition
Operator Description
= Equal to
!= Not Equal to
< Less than
> Greater than
<= Less than or Equal to
>= Greate than or Equal to
BETWEEN Between a specified range of values
LIKE This is used to search for a pattern in value.
IN In a given set of values
83. 5.0 SQL LIKE clause
• LIKE clause is used in the condition in SQL query with the
WHERE clause.
• LIKE clause compares data with an expression using wildcard
operators to match pattern given in the condition.
Wildcard operators
• There are two wildcard operators that are used in LIKE clause.
• Percent sign %: represents zero, one or more than one character.
• Underscore sign _: represents only a single character.
84. 5.0 SQL LIKE clause: Example
• Consider the following Student table.
• The above query will return all records where s_name starts with character 'A’.
SELECT * FROM Student WHERE s_name LIKE 'A%';
s_id s_Name age
101 Arunima 15
102 Alex 18
103 Abhi 17
s_id s_Name age
101 Arunima 15
102 Alex 18
103 Abhi 17
85. 8.0 SQL Aggregate Functions
• SQL aggregation function is used to
perform the calculations on multiple
rows of a single column of a table.
• It returns a single value.
• It is also used to summarize the data.
86. 8.0 Why use Aggregate Functions ?
• From a business perspective, different organization levels have different
information requirements.
• Top levels managers are usually interested in knowing whole figures and not
necessary the individual details.
• Aggregate functions allow us to easily produce summarized data from our
database.
• For instance, from our myflix database , management may require following reports
• Least rented movies.
• Most rented movies.
• Average number that each movie is rented out in a month.
• We easily produce above reports using aggregate functions.
88. FUNCTION
• Count returns the number of rows present in the table
either based on some condition or without condition.
• Its general syntax is,
SELECT COUNT(column_name) FROM table-name
89. FUNCTION …
• Consider the following Emp table
• SQL query to count employees, satisfying specified condition is,
• Result of the above query will be,
SELECT COUNT(name) FROM Emp WHERE salary = 8000;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
count(name)
2
90. FUNCTION …
• COUNT(DISTINCT expression) evaluates expression for each row in a group, and returns the number of
unique, non-null values.
• Example of COUNT(distinct) : Consider the following Emp table.
• SQL query is,
• Result of the above query will be,
SELECT COUNT(DISTINCT salary) FROM emp;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
count(distinct salary)
4
91. FUNCTION
• SUM function returns total sum of a selected columns
numeric values.
• Syntax for SUM is,
SELECT SUM(column_name) from table-name;
92. FUNCTION …
• Consider the following Emp table
• SQL query to find sum of salaries will be,
• Result of the above query will be,
SELECT SUM(salary) FROM emp;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
SUM(salary)
41000
93. FUNCTION
• Average returns average value after calculating it from
values in a numeric column.
• Its general syntax is,
SELECT AVG(column_name) FROM table_name
94. FUNCTION …
• Consider the following Emp table
• SQL query to find average salary will be,
• Result of the above query will be,
SELECT avg(salary) from Emp;
avg(salary)
8200
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
95. FUNCTION
• MAX function returns maximum value from selected
column of the table.
• Syntax of MAX function is,
SELECT MAX(column_name) from table-name;
96. FUNCTION …
• Using MAX() function :Consider the following Emp table
• SQL query to find the Maximum salary will be,
• Result of the above query will be,
SELECT MAX(salary) FROM emp;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
MAX(salary)
10000
97. FUNCTION
• MIN function returns minimum value from a selected
column of the table.
• Syntax for MIN function is,
SELECT MIN(column_name) from table-name;
98. FUNCTION …
• Using MIN() function :Consider the following Emp table
• SQL query to find the Minimum salary will be,
• Result of the above query will be,
SELECT MIN(salary) FROM emp;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
MIN(salary)
6000
99. FUNCTION
• First function returns first value of a selected column
• Syntax for FIRST function is,
SELECT FIRST(column_name) from table-name;
100. FUNCTION …
• Using FIRST() function :Consider the following Emp table
• SQL query will be,
• Result of the above query will be,
SELECT FIRST(salary) FROM Emp;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
first(salary)
9000
101. FUNCTION
• LAST function returns the return last value of the selected
column.
• Syntax of LAST function is,
SELECT LAST(column_name) from table-name;
102. FUNCTION …
• Using LAST() function :Consider the following Emp table
• SQL query will be,
• Result of the above query will be,
SELECT LAST(salary) FROM Emp;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
last(salary)
8000
103. FUNCTION
• Scalar functions return a single value from an input value.
• Following are some frequently used Scalar Functions in SQL.
• UCASE function is used to convert value of string column to
Uppercase characters.
• Syntax of UCASE,
SELECT UCASE(column_name) from table-name;
104. FUNCTION …
• Using UCASE() function :Consider the following Emp table
• SQL query for using UCASE is,
• Result is,
SELECT UCASE(name) FROM emp;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
UCASE(name)
ANU
SHANE
ROHAN
SCOTT
TIGER
105. FUNCTION
• LCASE function is used to convert value of string columns to
Lowecase characters.
• Syntax for LCASE is,
SELECT LCASE(column_name) from table-name;
106. FUNCTION …
• Using LCASE() function :Consider the following Emp table
• SQL query for using LCASE is,
• Result is,
SELECT LCASE(name) FROM emp;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
LCASE(name)
anu
shane
rohan
scott
tiger
107. FUNCTION
• MID function is used to extract substrings from column
values of string type in a table.
• Syntax for MID function is,
SELECT MID(column_name, start, length) from table-name;
108. FUNCTION …
• Using MID() function :Consider the following Emp table
• SQL query will be,
• Result is,
SELECT MID(name,2,2) FROM emp;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
MID(name,2,2)
nu
ha
oh
co
ig
109. FUNCTION
• ROUND function is used to round a numeric field to number
of nearest integer.
• It is used on Decimal point values.
• Syntax of Round function is,
SELECT ROUND(column_name, decimals) from table-name;
110. FUNCTION …
• Using ROUND() function :Consider the following Emp table
• SQL query will be,
• Result is,
SELECT ROUND(salary) from emp;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
ROUND(salary)
9001
8001
6000
10000
8000
111. 9.0 SQL ORDER BY Clause
• Order by clause is used with SELECT statement for
arranging retrieved data in sorted order.
• The Order by clause by default sorts the retrieved data in
ascending order.
• To sort the data in descending order DESC keyword is used
with Order by clause.
• Syntax of Order By
SELECT column-list|* FROM table-name ORDER BY ASC | DESC;
112. 9.1 SQL ORDER BY Clause …
• Using default Order by : Consider the following Emp table,
• The above query will return the resultant data in ascending order of the salary.
SELECT * FROM Emp ORDER BY salary;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
eid name age salary
403 Rohan 34 6000
402 Shane 29 8000
405 Tiger 35 8000
401 Anu 22 9000
404 Scott 44 10000
113. 9.2 SQL ORDER BY Clause …
• Using Order by DESC: Consider the following Emp table,
• The above query will return the resultant data in descending order of the salary.
SELECT * FROM Emp ORDER BY salary DESC;
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
eid name age salary
404 Scott 44 10000
401 Anu 22 9000
405 Tiger 35 8000
402 Shane 29 8000
403 Rohan 34 6000
114. 10.0 SQL GROUP BY Clause
• Group by clause is used to group the results of a SELECT
query based on one or more columns.
• It is also used with SQL functions to group the result from
one or more tables.
• Syntax for using Group by in a statement.
SELECT column_name, function(column_name)
FROM table_name
WHERE condition
GROUP BY column_name
115. 10.0 SQL GROUP BY Clause …
• Example of Group by in a Statement: Consider the following Emp table,
• Here we want to find name and age of employees grouped by their salaries or in
other words, we will be grouping employees based on their salaries, hence, as a
result, we will get a data set, with unique salaries listed, along side the first
employee's name and age to have that salary.
• group by is used to group different row of data together based on any one column.
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
116. 10.0 SQL GROUP BY Clause …
• SQL query for the above requirement will be,
• Result will be,
SELECT name, age
FROM Emp GROUP BY salary
name age
Rohan 34
Shane 29
Anu 22
117. 10.0 SQL GROUP BY Clause …
• Example of Group by in a Statement with WHERE clause: Consider the following Emp table,
• SQL query will be, group by is used to group different row of data together based on any one column.
• Result will be,
eid name age salary
401 Anu 22 9000
402 Shane 29 8000
403 Rohan 34 6000
404 Scott 44 10000
405 Tiger 35 8000
SELECT name, salary
FROM Emp
WHERE age > 25
GROUP BY salary
name salary
Rohan 6000
Shane 8000
Scott 9000
118. 3.3 DCL Commands
• DCL is short name of Data Control Language which
includes commands such as GRANT and mostly
concerned with rights, permissions and other controls
of the database system.
GRANT - allow users access privileges to the database
REVOKE - withdraw users access privileges given by
using the GRANT command
119. 3.4 TCL Commands
• TCL is short name of Transaction Control Language which deals
with a transaction within a database.
COMMIT - commits a Transaction
ROLLBACK - rollback a transaction in case of any error occurs
SAVEPOINT - to rollback the transaction making points within
groups
SET TRANSACTION - specify characteristics of the transaction