GithubHelp home page GithubHelp logo

duplicate-records's Introduction

EXP 05: DUPLICATE RECORDS

AIM:

To fetch the duplicate records existing in the table using SQL.

ALGORITHM:

  1. Create a sample table in SQL using CREATE TABLE syntax

  2. Insert all the values and Titles respectively using INSERT INTO syntax

  3. Now check whether all the rows are affected or not by fetching the table

  4. After checking, now use SELECT for choosing the column name that we want and use FROM to choose the table

  5. Then use GROUP BY syntax to group the column containing duplicates and count them to display by using COUNT.

  6. After compiling and running the program, the results will be displayed.

PROGRAM:

create table Zoo(
  Sno int,
  Animal varchar(50),
  No_of_animals int
);
insert into Zoo (Sno,Animal,No_of_animals)
values (1,'Leopard',5);
insert into Zoo (Sno,Animal,No_of_animals)
values (2,'Turtle',10);
insert into Zoo (Sno,Animal,No_of_animals)
values (3,'Elephant',15);
insert into Zoo (Sno,Animal,No_of_animals)
values (4,'Cheetah',3);
insert into Zoo (Sno,Animal,No_of_animals)
values (5,'Tiger',5);
insert into Zoo (Sno,Animal,No_of_animals)
values (6,'Otter',7);
insert into Zoo (Sno,Animal,No_of_animals)
values (7,'Giraffe',4);
insert into Zoo (Sno,Animal,No_of_animals)
values (8,'Crocodile',6);
insert into Zoo (Sno,Animal,No_of_animals)
values (9,'Koala',7);
insert into Zoo (Sno,Animal,No_of_animals)
values (10,'White tiger',3);

select No_of_animals as noa, count(No_of_animals) as count
from Zoo
group by No_of_animals
having count(No_of_animals)> 1;

OUTPUT:

image

RESULT:

Thus we have successfully obtained the required result using the above-given code.

duplicate-records's People

Contributors

harshavardhini33 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.