Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • DSA
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps
    • Software and Tools
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Go Premium
  • Guidelines to Write Experiences
  • Write Interview Experience
  • Write Work Experience
  • Write Admission Experience
  • Write Campus Experience
  • Write Engineering Experience
  • Write Coaching Experience
  • Write Professional Degree Experience
  • Write Govt. Exam Experiences
Open In App

Database Administrator Interview Questions

Last Updated : 23 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Explore these carefully collected Database Administrator (DBA) interview questions to equip yourself for a successful career move in the realm of database management. Familiarize yourself with the types of questions often encountered in technical assessments and problem-solving scenarios. Enhance your preparation for interviews by diving into these questions. A Database Administrator is a crucial role responsible for managing and organizing data systems. As an expert in database technology, a DBA ensures the efficiency, security, and reliability of data storage. Discover exciting career prospects in the dynamic field of database administration and gear up for a rewarding journey in this important role.

DATABASE-ADM-copy
Database Administrator Interview Questions

Securing the role you want as a Database Administrator isn't only about technical know-how – it's also about understanding how interviews in this fieldwork. This guide offers a detailed exploration of what to expect in Database Administrator interviews, giving you insights into the kinds of questions you might encounter.

Q1. Write a simple SQL query to retrieve all columns from a table named "employees."

To retrieve all columns from a table named "employees," you can use the following SQL query:

SELECT * FROM employees;

Q2. Explain the difference between INNER JOIN and LEFT JOIN. Provide an example for each.

INNER JOIN

The INNER JOIN keyword selects all rows from both tables as long as the condition is satisfied. This keyword will create the result set by combining all rows from both the tables where the condition satisfies i.e. the value of the common field will be the same. 

Syntax: 

SELECT table1.column1,table1.column2,table2.column1,....
FROM table1
INNER JOIN table2
ON table1.matching_column = table2.matching_column;

table1: First table.
table2: Second table
matching_column: Column common to both the tables.

Note: We can also write JOIN instead of INNER JOIN. JOIN is the same as INNER JOIN. 

LEFT JOIN

This join returns all the rows of the table on the left side of the join and matches rows for the table on the right side of the join. For the rows for which there is no matching row on the right side, the result-set will contain null. LEFT JOIN is also known as LEFT OUTER JOIN.

Syntax: 

SELECT table1.column1,table1.column2,table2.column1,....
FROM table1
LEFT JOIN table2
ON table1.matching_column = table2.matching_column;

table1: First table.
table2: Second table
matching_column: Column common to both the tables.

Note: We can also use LEFT OUTER JOIN instead of LEFT JOIN, both are the same.

Q3. What is a subquery, and how is it different from a JOIN? Provide an example of using a subquery.
A subquery, as the name itself suggests, is a query within another query. It acts like a mini-query that helps to solve a specific part of the main query, and its results are used by the outer query to filter or manipulate the final data. Subqueries are nested queries that filter data based on the results of another query, while joins combine data from multiple tables based on a shared relationship. Subqueries are generally easier to understand but less efficient for large datasets, while joins are more efficient but can be a little complex.

For ex:

Find all customers who placed orders exceeding the average order amount.

Subquery for the above question:

SELECT * FROM customers

WHERE customer_id IN (

SELECT customer_id

FROM orders

WHERE amount > (SELECT AVG(amount) FROM orders)

);

Q4.Write a SQL query to calculate the average salary of employees in a specific department.

SELECT AVG(salary) AS average_salary

FROM employees

WHERE department_id = your_department_id;

Q5. Write a SQL query to find the second-highest salary in an "employees" table.

select * from employee where salary=(select Max(salary) from employee);

Q6. SQL HAVING Clause with Examples

The HAVING clause was introduced in SQL to allow the filtering of query results based on aggregate functions and groupings, which cannot be achieved using the WHERE clause that is used to filter individual rows.

Q7. Stored procedures in SQL
Stored procedures are prepared SQL code that you save so you can reuse it over and over again. So if you have an SQL query that you write over and over again, save it as a stored procedure and call it to run it.

Q8 What is Data Normalization and Why Is It Important?

Normalization is the process of reducing data redundancy in a table and improving data integrity. Then why do you need it? If there is no normalization in SQL, there will be many problems, such as:

  • Insert Anomaly: This happens when we cannot insert data into the table without another.
  • Update Anomaly: This is due to data inconsistency caused by data redundancy and data update.
  • Delete exception: Occurs when some attributes are lost due to the deletion of other attributes

The main use of normalization is to utilize in order to remove anomalies that are caused because of the transitive dependency. Normalization is to minimize the redundancy and remove Insert, Update and Delete Anomaly. It divides larger tables into smaller tables and links them using relationships.

Need for normalization :

  • It eliminates redundant data.
  • It reduces the chances of data error.
  • The normalization is important because it allows the database to take up less disk 
    space.
  • It also helps in increasing the performance.
  • It improves the data integrity and consistency.

Q9. Third Normal Form (3NF)

A relation is in the third normal form, if there is no transitive dependency for non-prime attributes as well as it is in the second normal form. A relation is in 3NF if at least one of the following conditions holds in every non-trivial function dependency X –> Y.

  • X is a super key.
  • Y is a prime attribute (each element of Y is part of some candidate key).

In other words

A relation that is in First and Second Normal Form and in which no non-primary-key attribute is transitively dependent on the primary key, then it is in Third Normal Form (3NF).

Q10. Denormalization in Databases
Denormalization is a database optimization technique in which we add redundant data to one or more tables. This can help us avoid costly joins in a relational database. Note that denormalization does not mean ‘reversing normalization’ or ‘not to normalize’. It is an optimization technique that is applied after normalization.

Q11.Composite Key in SQL
A composite key is made by the combination of two or more columns in a table that can be used to uniquely identify each row in the table when the columns are combined uniqueness of a row is guaranteed, but when it is taken individually it does not guarantee uniqueness, or it can also be understood as a primary key made by the combination of two or more attributes to uniquely identify every row in a table.

Note: 

  •  A composite key can also be made by the combination of more than one candidate key.
  • A composite key cannot be null.

Q12. How to Draw Entity Relationship Diagrams
In the world of database design, entity relationship diagrams serve as valuable tools for designing complex systems and their relationships. In this article will go through the step-by-step process of designing an ER diagram, and defining how entities, attributes, and relationships are defined. Entity relationship diagrams are extremely important in database design and require a clear structure of all data.

Entity Relationship Diagram for BANK

We are following the below steps to design an ER diagram:

  • Defining Entities
  • Adding Attributes
  • Establishing Relationships
  • Specify Cardinality
  • Identify Primary Keys
  • Draw the ER Diagram
  • Benefits of ER Diagram

Q13. Database Normalization vs Database Optimization

Factor

Database Normalization

Database Optimization

ProcessDatabase Normalization involves breaking up data into smaller, related tables and creating relationships between them.Database Optimization involves making changes to the physical structure of the database, such as adding indexes, creating partitions, and reorganizing tables and other system parameters.
SecurityDatabase normalization does not affect database security.Database optimization can improve database security.
Data AccessDatabase normalization does not affect data access.Database optimization can improve data access.
OutputDatabase Normalization results in a more organized and efficient database structure.Database Optimization results in a faster and more efficient database.

Q14. SQL*Plus Command Reference
SQLPlus is a command-line tool for Oracle Database that allows users to interact with the database using SQL and PL/SQL commands. When passing SQL commands as arguments to SQLPlus in a Linux environment, there are limits on the maximum length of the command line. In this article, we will learn about the Maximum length of command line arguments that can be passed to SQL*Plus.

Command Line Arguments in SQL*Plus

Command line arguments in SQL*Plus serve as parameters that control the behavior of the tool. These arguments can include script names, connection details, and other options. Users frequently utilize these arguments to streamline their workflows and automate tasks.

Maximum Length of Command Line Argument

The maximum length of a command line argument is determined by the operating system. In Linux, the maximum length is typically 131,072 bytes (or 128 KB). This includes the length of the SQL*Plus command, SQL query, and any additional parameters.

Syntax:

sqlplus [username]/[password]@[database] @script.sql

  • sqlplus: Command to start SQL*Plus.
  • [username]/[password]@[database]: Connection details to log in to the Oracle Database.
  • @script.sql: The SQL script file to be executed.

Q15. Difference between MS SQL Server and PostgreSQL

MS SQL SERVER

POSTGRESQL

Developed by Microsoft Corporation and initially released on April 24, 1989Developed by PostgreSQL Global Development Group on 1989.
MS SQL server is written in C++ language.PostgreSQL is written in C language.
It is a Microsoft relational DBMS.It is a widely used open-source RDBMS.
The primary database model for MS SQL Server is Relational DBMS.The primary database model for PostgreSQL is also Relational DBMS.
It also has two Secondary database models – Document Store and Graph DBMS.It has a Document store as a Secondary database model.

Q16. What is the Data Replication?
Data Replication is the process of storing data in more than one site or node. It is useful in improving the availability of data. It is simply copying data from a database from one server to another server so that all the users can share the same data without any inconsistency.
Types of Data Replication –

  1. Transactional Replication: In Transactional replication users receive full initial copies of the database and then receive updates as data changes. Data is copied in real-time from the publisher to the receiving database(subscriber) in the same order as they occur with the publisher therefore in this type of replication, transactional consistency is guaranteed.
  2. Snapshot Replication: Snapshot replication distributes data exactly as it appears at a specific moment in time and the does not monitor for updates to the data. The entire snapshot is generated and sent to Users. Snapshot replication is generally used when data changes are infrequent.
  3. Merge Replication: Data from two or more databases is combined into a single database. Merge replication is the most complex type of replication because it allows both publisher and subscriber to independently make changes to the database.

Q17. What is SQL injection?

SQL injection is a technique used to extract user data by injecting web page inputs as statements through SQL commands. Basically, malicious users can use these instructions to manipulate the application’s web server.

  1. SQL injection is a code injection technique that can compromise your database.
  2. SQL injection is one of the most common web hacking techniques.
  3. SQL injection is the injection of malicious code into SQL statements via web page input.

Q18. What is Data Masking? 
Data masking is a very important concept to keep data safe from any breaches. Especially, for big organizations that contain heaps of sensitive data that can be easily compromised. Details like credit card information, phone numbers, and house addresses are highly vulnerable information that must be protected. To understand data masking better we first need to know what computer networks are.

Q19. Control Methods of Database Security 
Database Security means keeping sensitive information safe and preventing the loss of data. The security of the database is controlled by Database Administrator (DBA). 

The following are the main control measures used to provide the security of data in databases: 

  1. Authentication
  2. Access control
  3. Inference control
  4. Flow control
  5. Database Security applying Statistical Method
  6. Encryption

Q20. What is Data Encryption? 
Data Encryption is a method of preserving data confidentiality by transforming it into ciphertext, which can only be decoded using a unique decryption key produced at the time of the encryption or prior to it.

Data encryption converts data into a different form (code) that can only be accessed by people who have a secret key (formally known as a decryption key) or password. Data that has not been encrypted is referred to as plaintext, and data that has been encrypted is referred to as ciphertext. Encryption is one of the most widely used and successful data protection technologies in today’s corporate world.

Q21. What are the benefits of implementing two-factor authentication in a database environment?

Implementing two-factor authentication (2FA) in a database context adds a strong layer of protection, functioning as a virtual bouncer for sensitive data. Consider it a double lock for your most critical information. Here are a few human-friendly benefits:

  • Double Lock, Double Security: Just as opening a high-security vault takes both a key and a fingerprint, two-factor authentication requires two distinct forms of identity. This implies that even if someone learns your password, they'll still need the second piece of the puzzle.
  • Guarding Against Stolen Passwords: Passwords can leak or be stolen. Even if your password is hacked, 2FA adds an extra layer of security (such as a temporary code texted to your phone) to prevent an intruder from gaining access.
  • Remote Access Protection: In a world where remote work is becoming more frequent, 2FA serves as a virtual bodyguard for your data, making it more difficult for unauthorised users to penetrate the system, even if they are not physically there.
  • Preventing Unauthorized Access: 2FA provides an additional degree of security against brute force attacks and other malicious efforts to acquire unauthorised access. It's like having a gatekeeper who requires both a key and a secret handshake.

Q22. What is DBCC?
Database Console Commands (DBCC) is a set of Transact-SQL commands for database management and maintenance in Microsoft SQL Server. 

Here are a few key uses of DBCC commands:

  • Checking Database Consistency: DBCC commands, such as DBCC CHECKDB, are used to verify the logical and physical integrity of a database. They can assist in identifying and resolving corruption, missing indexes, and other structural issues.
  • Performance Tuning: Some DBCC commands provide information about database performance and can be used to tune the performance of SQL Server. For example, DBCC SQLPERF provides information about various performance-related counters.
  • Statistics Updates: DBCC procedures like as DBCC UPDATEUSAGE and DBCC SHOW_STATISTICS are used to update and show statistics about database objects. Keeping statistics up to current is critical for the query optimizer to build effective execution plans.

Q23. SQL Queries on Clustered and Non-Clustered Indexes

Indexing is a procedure that returns your requested data faster from the defined table. Without indexing, the SQL server has to scan the whole table for your data. By indexing, the SQL server will do the exact same thing you do when searching for content in a book by checking the index page. In the same way, a table’s index allows us to locate the exact data without scanning the whole table. There are two types of indexing in SQL.

  • Clustered index
  • Non-clustered index

Clustered Index

A clustered index is the type of indexing that establishes a physical sorting order of rows.

Suppose you have a table Student_info which contains ROLL_NO as a primary key, then the clustered index which is self-created on that primary key will sort the Student_info table as per ROLL_NO. A clustered index is like a Dictionary; in the dictionary, the sorting order is alphabetical and there is no separate index page. 

Examples:

CREATE TABLE Student_info
(
ROLL_NO int(10) primary key,
NAME varchar(20),
DEPARTMENT varchar(20),
);
INSERT INTO Student_info values(1410110405, 'H Agarwal', 'CSE');
INSERT INTO Student_info values(1410110404, 'S Samadder', 'CSE');
INSERT INTO Student_info values(1410110403, 'MD Irfan', 'CSE');

SELECT * FROM Student_info;


Output:

ROLL_NO

NAME

DEPARTMENT

1410110403MD IrfanCSE
1410110404S SamadderCSE
1410110405H AgarwalCSE

Q24. Describe what taking a database offline means.

In the context of database administration, taking a database offline means temporarily removing it from an active state, rendering it unreachable to users and applications. When a database is taken offline, the database engine disallows new connections and terminates current ones. This action can be used for a variety of administrative and maintenance duties. Here's an overview of what putting a database offline entails:

  • No User Access: When a database is taken offline, users and programs are no longer able to connect or interact with it. Attempts to access the database while in this offline state will result in an error.
  • Administrative tasks: Taking a database offline is frequently used to undertake administrative procedures that require exclusive access to the database. This might involve things like running a backup, installing updates or fixes, or migrating database files.
  • Maintenance Operations: Maintenance procedures, such as rebuilding indexes, updating statistics, or making substantial changes to the database structure, may necessitate taking the database offline to guarantee data consistency and prevent any conflicts.

Q25. What is Summary.txt and Detail.txt?

File Name

Purpose

Content

Summary.txtOverview of high-level summaryCondensed summary of events, actions, or data
Detail.txtDetailed information or granular breakdownIn-depth log or detailed information about specific events/data

K

kartik
Improve
Article Tags :
  • Interview Experiences
  • interview-preparation
  • Interview-Questions
  • Technical Interview Questions
  • Database Administrator

Similar Reads

    GBlog - Explore Tech’s Hottest Topics & Career Growth Hacks!
    Are you a tech person who's interested in learning new technology and decoding the future? GeeksforGeeks has a section for all tech enthusiasts where you can feed the tech monster inside you with high-level content. GBlog is your ultimate pitstop where innovation meets insight, and trends transform
    2 min read

    How To Become

    How to become a Java Developer?
    Java is among the most preferred languages for development across the world common in website and mobile application development and for enterprise solutions. This article aims to explain various practical steps of how one can become a competent Java developer, the job description, and the general f
    6 min read
    How to Become a GenAI Developer
    Generative AI is one of the most exciting and evolving areas of research in artificial intelligence, and it defines the relationship between technology and humans. With its ability to produce content from text, images, music, and videos, generative AI is contributing to the evolution of different in
    8 min read
    How to become a Cloud Network Engineer?
    Cloud Network Engineers play a vital role in ensuring that cloud services run smoothly for modern businesses. Big companies like Amazon, Google, and Microsoft are actively hiring DevOps engineers to manage and optimize their cloud infrastructures. As more organizations shift towards cloud computing,
    11 min read
    How to Become a DevSecOps Engineer
    A DevSecOps Engineer plays a crucial role in ensuring that security is embedded into every step of the software development process, combining development, security, and operations. Companies like Google, Amazon, Microsoft, IBM, and Netflix are actively hiring DevSecOps Engineers to protect their ap
    9 min read
    How to become an Automation Tester?
    Automation testers are those who focus on quality assurance and particularly specialize in the automation of the testing process. They design and run tests with various tools that automate the testing procedure to check the performance, functionality, and security of the software. An automation test
    11 min read

    Roadmap

    Full Stack Developer Roadmap [2025 Updated]
    Web Developer/ Full Stack Web Developer - How do you feel when you tag yourself with such titles? A long journey takes place to be called by such names. In the beginning, you might feel bored or terrified, but, trust me, this is the most popular and interesting field one should work on. You can also
    15 min read
    Complete DevOps Roadmap - Beginner to Advanced
    DevOps is considered a set of practices that combines the abilities of Software Development i.e Dev and IT Operations i.e Ops together, which results in delivering top-notch quality software fastly and more efficiently. Its focus is to encourage communication, collaboration, and integration between
    8 min read
    Machine Learning Roadmap
    Nowadays, machine learning (ML) is a key tool for gaining insights from complex data and driving innovation in many industries. As more businesses rely on data for decision-making, having machine learning skills is more important than ever. By mastering ML, you can tackle real-world problems and cre
    11 min read
    Data Analyst Roadmap 2025 - A Complete Guide
    Dreaming of a career where you unlock the secrets hidden within data and drive informed business decisions? Becoming a data analyst could be your perfect path! This comprehensive Data Analyst Roadmapfor beginners unveils everything you need to know about navigating this exciting field, including ess
    7 min read

    Interview Preparation

    Interview Preparation Roadmap
    Preparing for technical interviews can often feel overwhelming due to the breadth of topics involved. However, a well-structured roadmap makes it easier to focus on the right subjects and systematically build your skills.This article outlines a step-by-step preparation plan covering key areas that y
    5 min read
    Top Interview Problems Asked in 2024 (Topic Wise)
    In this post, we present a list of the latest asked data structures and algorithms (DSA) coding questions to help you prepare for interviews at leading tech companies like Meta, Google, Amazon, Apple, Microsoft, etc. This list helps you to cover an extensive variety of DSA Coding questions topic-wis
    2 min read
    Top HR Interview Questions and Answers (2025)
    HR interviews can be daunting but they don’t have to be. The bottom line in most hiring processes entails testing the personality of a candidate for their communication traits and company culture fit. Being at the initial or experienced levels of your career being prepared for commonly asked fresher
    15+ min read
    Database Administrator Interview Questions
    Explore these carefully collected Database Administrator (DBA) interview questions to equip yourself for a successful career move in the realm of database management. Familiarize yourself with the types of questions often encountered in technical assessments and problem-solving scenarios. Enhance yo
    14 min read
    Aptitude Questions and Answers
    Aptitude questions can be challenging, but with the right preparation and practice, you can tackle them with ease. Our comprehensive guide to aptitude questions and answers covers all the essential topics of Aptitude, including Quantitative Aptitude, Logical Reasoning, and Verbal Ability. Whether yo
    4 min read

    Project Ideas

    10 Best Computer Science Projects Ideas for Final Year Students
    Final year CSE projects are a student's big moment to showcase what they've learned. It's where they take all their computer science knowledge and use it to create something cool and useful. These projects can range from smart apps to blockchain systems that solve real-world problems.They're crucial
    8 min read
    Top 10 Mini Project Ideas For Computer Science Students
    Projects play a vital role in both enhancing skill sets and making a CV (curriculum vitae) stronger. If you have good projects in your CV, this undoubtedly makes a good impression on the recruiters. Also, If one wants to master some new skill, the only way is to implement it in some project. New tec
    7 min read
    30+ Web Development Projects with Source Code [2025]
    Web development is one of the most in-demand career paths in the IT industry, experiencing consistent growth of around 20–25% annually. Whether you're a student starting out or an experienced professional looking to switch or advance your career, it's essential to go beyond theory and demonstrate yo
    4 min read
    Top 10 Data Science Project Ideas for Beginners
    Data Science and its subfields can demoralize you at the initial stage if you're a beginner. The reason is that understanding the transitions in statistics, programming skills (like R and Python), and algorithms (whether supervised or unsupervised) is tough to remember as well as implement.Are you p
    13 min read
    Top 50 Java Project Ideas For Beginners and Advanced [Update 2025]
    Java is one of the most popular and versatile programming languages, known for its reliability, security, and platform independence. Developed by James Gosling in 1982, Java is widely used across industries like big data, mobile development, finance, and e-commerce.Building Java projects is an excel
    15+ min read
    10 Best Linux Project Ideas For Beginners
    Linux is a famous operating system that looks complicated at first, but there are a few ways to master it. According to the statistics, more than 45% of professional developers work on Linux. That's why developing your skills in Linux can be a good option. As a Linux geek, you can get your hands on
    7 min read
    Top 7 Python Project Ideas for Beginners in 2025
    Python is one of the most popular programming languages due to its simplicity, versatility, and supportive community. Whether you’re a beginner eager to learn the basics or an experienced programmer looking to challenge your skills, there are countless Python projects to help you grow.Here is the li
    6 min read

    Certification

    Top Machine Learning Certifications in 2025
    Machine learning is a critical skill in today’s tech-driven world, affecting sectors such as healthcare, finance, retail, and others. As organizations depend more on artificial intelligence (AI) to solve complex problems, the need for machine learning professionals is skyrocketing. For those looking
    9 min read
    DevOps Certification - A Way to Enhance Growth Opportunities
    DevOps has become a trendy term. It plays an important role in enhancing the growth opportunity for both professionals and organizational setups. The investment of businesses in DevOps has also increased from 66% in 2015 to 76% in 2017. In 2019, 85-90% of businesses adopted DevOps technology. Based
    4 min read
    Top 10 Highest Paying Certifications
    The year 2025 has taught numerous things to the entire world, and from a career perspective, the importance of upskilling yourself has also surged in this particular period. People now have realized that to sustain in this rapidly growing tech world, you're constantly required to improve your skills
    11 min read
    Tech Certifications: Worth the Effort in 2025?
    One should stay ahead of the game in an ever-changing technological world. Therefore, if you want to proceed in your career, it is important to always be a step ahead. Tech certifications have become one of the most commonly used methods today that can help measure someone’s proficiency levels and k
    9 min read
`; $(commentSectionTemplate).insertBefore(".article--recommended"); } loadComments(); }); }); function loadComments() { if ($("iframe[id*='discuss-iframe']").length top_of_element && top_of_screen articleRecommendedTop && top_of_screen articleRecommendedBottom)) { if (!isfollowingApiCall) { isfollowingApiCall = true; setTimeout(function(){ if (loginData && loginData.isLoggedIn) { if (loginData.userName !== $('#followAuthor').val()) { is_following(); } else { $('.profileCard-profile-picture').css('background-color', '#E7E7E7'); } } else { $('.follow-btn').removeClass('hideIt'); } }, 3000); } } }); } $(".accordion-header").click(function() { var arrowIcon = $(this).find('.bottom-arrow-icon'); arrowIcon.toggleClass('rotate180'); }); }); window.isReportArticle = false; function report_article(){ if (!loginData || !loginData.isLoggedIn) { const loginModalButton = $('.login-modal-btn') if (loginModalButton.length) { loginModalButton.click(); } return; } if(!window.isReportArticle){ //to add loader $('.report-loader').addClass('spinner'); jQuery('#report_modal_content').load(gfgSiteUrl+'wp-content/themes/iconic-one/report-modal.php', { PRACTICE_API_URL: practiceAPIURL, PRACTICE_URL:practiceURL },function(responseTxt, statusTxt, xhr){ if(statusTxt == "error"){ alert("Error: " + xhr.status + ": " + xhr.statusText); } }); }else{ window.scrollTo({ top: 0, behavior: 'smooth' }); $("#report_modal_content").show(); } } function closeShareModal() { const shareOption = document.querySelector('[data-gfg-action="share-article"]'); shareOption.classList.remove("hover_share_menu"); let shareModal = document.querySelector(".hover__share-modal-container"); shareModal && shareModal.remove(); } function openShareModal() { closeShareModal(); // Remove existing modal if any let shareModal = document.querySelector(".three_dot_dropdown_share"); shareModal.appendChild(Object.assign(document.createElement("div"), { className: "hover__share-modal-container" })); document.querySelector(".hover__share-modal-container").append( Object.assign(document.createElement('div'), { className: "share__modal" }), ); document.querySelector(".share__modal").append(Object.assign(document.createElement('h1'), { className: "share__modal-heading" }, { textContent: "Share to" })); const socialOptions = ["LinkedIn", "WhatsApp","Twitter", "Copy Link"]; socialOptions.forEach((socialOption) => { const socialContainer = Object.assign(document.createElement('div'), { className: "social__container" }); const icon = Object.assign(document.createElement("div"), { className: `share__icon share__${socialOption.split(" ").join("")}-icon` }); const socialText = Object.assign(document.createElement("span"), { className: "share__option-text" }, { textContent: `${socialOption}` }); const shareLink = (socialOption === "Copy Link") ? Object.assign(document.createElement('div'), { role: "button", className: "link-container CopyLink" }) : Object.assign(document.createElement('a'), { className: "link-container" }); if (socialOption === "LinkedIn") { shareLink.setAttribute('href', `https://www.linkedin.com/sharing/share-offsite/?url=${window.location.href}`); shareLink.setAttribute('target', '_blank'); } if (socialOption === "WhatsApp") { shareLink.setAttribute('href', `https://api.whatsapp.com/send?text=${window.location.href}`); shareLink.setAttribute('target', "_blank"); } if (socialOption === "Twitter") { shareLink.setAttribute('href', `https://twitter.com/intent/tweet?url=${window.location.href}`); shareLink.setAttribute('target', "_blank"); } shareLink.append(icon, socialText); socialContainer.append(shareLink); document.querySelector(".share__modal").appendChild(socialContainer); //adding copy url functionality if(socialOption === "Copy Link") { shareLink.addEventListener("click", function() { var tempInput = document.createElement("input"); tempInput.value = window.location.href; document.body.appendChild(tempInput); tempInput.select(); tempInput.setSelectionRange(0, 99999); // For mobile devices document.execCommand('copy'); document.body.removeChild(tempInput); this.querySelector(".share__option-text").textContent = "Copied" }) } }); // document.querySelector(".hover__share-modal-container").addEventListener("mouseover", () => document.querySelector('[data-gfg-action="share-article"]').classList.add("hover_share_menu")); } function toggleLikeElementVisibility(selector, show) { document.querySelector(`.${selector}`).style.display = show ? "block" : "none"; } function closeKebabMenu(){ document.getElementById("myDropdown").classList.toggle("show"); }
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Campus Training Program
  • Explore
  • POTD
  • Job-A-Thon
  • Community
  • Videos
  • Blogs
  • Nation Skill Up
  • Tutorials
  • Programming Languages
  • DSA
  • Web Technology
  • AI, ML & Data Science
  • DevOps
  • CS Core Subjects
  • Interview Preparation
  • GATE
  • Software and Tools
  • Courses
  • IBM Certification
  • DSA and Placements
  • Web Development
  • Programming Languages
  • DevOps & Cloud
  • GATE
  • Trending Technologies
  • Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
  • Preparation Corner
  • Aptitude
  • Puzzles
  • GfG 160
  • DSA 360
  • System Design
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences