in Databases
4,504 views
4 votes
4 votes

The 'command' used to change contents of one database using the contents of another database by linking them on a common key field?

  1. Replace
  2. Join
  3. Change
  4. Update
in Databases
by
4.5k views

1 comment

Please confirm the answer for this question. I think answer should be update.

Refer: https://www.javatpoint.com/sql-update-with-join

0
0

4 Answers

3 votes
3 votes

ans is (b)

join clause combines columns from one or more tables in a relationaldatabase. It creates a set that can be saved as a table or used as it is. A JOIN is a means for combining columns from one (self-table) or more tables by using values common to each.

1 comment

Why update cant be the answer as we change the contents of the table with this command only with the help of join command. Please explain.
0
0
1 vote
1 vote

Answer is B 

Replace command in sql :  Replaces all occurrences of a specified string value with another string value

Change : I don't think any command in db is there with Change key word

Update : Update a record in table

0 votes
0 votes
I guess the answer is b)join .

But join does not change the contents of the database
by

1 comment

Agree..
0
0
0 votes
0 votes
D. Update
 
 
Consider a situation:
A table named as USER_DATA is there which contains user details. This table has one column(along with other columns) named as  IS_ACTIVE which contain ‘0’ for a user, when a user will be in-active.
One other table is there named as BLOG_DETAILS which contains columns asAUTHOR_ID, IS_ACTIVE and other column to keep blog details.
Now if we want to run a script which should make column IS_ACTIVE = 0 in theBLOG_DATA table for in-active users. Here, we need a sql script which will containUPDATE with JOIN.
 
BLOG_DETAILS->AUTHOR_ID is foreign key which refers to the primary key USER_DATA->USER_ID
 
We can write the following query
 
UPDATE BLOG_DETAILS SET IS_ACTIVE = 0 FROM BLOG_DETAILS BD INNER JOIN USER_DATA UD ON UD.USER_ID = BD.AUTHOR_ID AND UD.IS_ACTIVE = 0
 
and we are done…
Answer:

Related questions