Informatics Practices
Ms. Manisha, a veterinarian, created a table 'VETERINARY' with the following columns:
ANIMAL_ID, VACCINATION_DATE, ANIMAL, OWNER_NAME
She wants to see the details of all the animals other than Dog and Cat which she has vaccinated.
She has written the following query:
SELECT * FROM VETERINARY WHERE ANIMAL NOT IN ('DOG', 'CAT');
Write a suitable alternate query for producing the same result.
Relational Database
1 Like
Answer
SELECT * FROM VETERINARY
WHERE ANIMAL != 'DOG' AND ANIMAL != 'CAT';
Answered By
2 Likes
Related Questions
Kunal has entered the following SQL command in the table 'STUDENT' that has TotalMarks as one of the columns:
SELECT * FROM Student; #Statement-1
The total number of rows displayed is 20.
Then Kunal enters the following command:
SELECT * FROM STUDENT WHERE TotalMarks < 100; #Statement-2
The number of rows displayed is 15.
Kunal then enters the following command:
SELECT * FROM STUDENT WHERE TotalMarks >= 100; #Statement-3
He predicts the output of the above query as 5. Do you agree with Kunal? Give reasons for your answer.
Mr. Shivaya is using a table 'COURSE' with the following columns: COURSE_ID, COURSE_NAME. He needs to display the names of all the courses which end with "SCIENCE". He has written the query mentioned below, which is not giving the desired result.
SELECT COURSE_ID, COURSE_NAME FROM COURSE WHERE COURSE_NAME = '_SCIENCE';
Help Mr. Shivaya to write the correct query.
Your school management has decided to organize cricket matches between students of Classes XI and XII. All the students are divided into four teams—Team Rockstars, Team BigGamers, Team Magnet and Team Current. During the summer vacations, various matches are to be held between these teams. Help your sports teacher do the following:
(a) Create a database "Sports" and open it for creating table.
(b) Create a table "Team" with the following considerations:
- It should have a column TeamID for storing an integer value between 1 and 9, which refers to unique identification of a team.
- Each TeamID should have its associated name (TeamName), which should be a string of length not less than 10 characters.
- Give the statement to make TeamID the primary key.
(c) Show the structure of the table Team using SQL command.
(d) As per the preferences of the students, four teams were formed as given below.
Insert these four rows in Team table:
Row 1: (1, Team Rockstars)
Row 2: (2, Team BigGamers)
Row 3: (3, Team Magnet)
Row 4: (4, Team Current)(e) Display the table Team.
What is data?