Correct

只要 vs 只有

/ zhǐyào vs zhī yǒu /
Strokes

Formula

1
只要……就
2
只有……才

Definition

只要 as a Conjunction, 只有 as a Conjunction or an Adverb, which means [so long as; if only; have to; be forced to].

只要 and 只有 both are Conjunctions, used to connect the condition and the main clause in a complex sentence, but the conditions they introduce and the connectives used in correspondingly are different. 只有 is also an adverb.

Example

The conjunction 只要 introduces adequate conditions. The speaker considers the requirement is not high, and with this minimum condition one can get the beseeched result.
It is placed either before or after the subject of the first clause and often corresponds with 就.
只要……就
1
Zhǐyào
只要
yòngxīn
用心
  
,
jiù
dìng
一定
néng
xuéhuì
学会
  

If only you work hard,you will learn it.

2
zhǐyào
只要
yǒu
shíjiān
时间
  
,
jiù
zhǎo
  

I will come to you if I have time.

3
Zhǐyào
只要
kěn
努力
  
,
zhè
jiàn
shì
dìng
一定
néng
bàn
hǎo
  

As long as he works hard,he will do a good job about it.

4
Zhǐyào
只要
  
,
jiù
  
,
guǎn
不管
biéren
别人
  

As long as you go, I will go, whether others go or not.

The conjunction 只有 indicates "the only necessary condition". The speaker thinks that the requirement is high and no other condition will do.
It is used in the first clause of a complex sentence and often corresponds with 才.
只有……才
5
Zhīyǒu
只有
yòngxīn
用心
xué
cái
néng
xuéhuì
学会
  

You can master it as long as you are devoted to it.

6
Zhīyǒu
只有
zài
jǐn
紧急
de
qíngkuàng
情况
xià
  
,
cái
yǔn
允许
yòng
zhè
这笔
qián
  

The money will only be spent in case of emergency.

7
zhīyǒu
只有
zài
zuì
lěng
de
shíhou
时候
  
,
cái
chuān
穿
mián
棉衣
  

He will put on padded coat in case of cold weather.

8
Zhīyǒu
只有
de
父母
cái
zhīdào
知道
de
xìng
性格
diǎn
特点
  

Only his parents know his temper.

9
máng
de
hěn
  
,
zhīyǒu
只有
zài
chīfàn
吃饭
de
shíhou
时候
  
,
cái
néng
zhǎodào
找到
  

You can find him only when he is having dinner for he's very busy.

The adverb 只有 indicates that this is the only way out and there is no other way; it has the meaning of 只好 (cannot but).
In examples ⑩ ⑪ and ⑫, the two words are not interchangeable.
10
Méiyǒu
没有
biède
别的
zǒu
  
,
zhīyǒu
只有
zǒu
zhè
tiáo
xiǎo
小路
le
  

We have no other road to go but to take this path.

11
xià
de
zhème
这么
  
,
dēngshān
登山
zhīyǒu
只有
gǎi
le
  

Climbing had to be put off for it rained so heavily.

12
zǒng
lái
  
,
men
我们
zhīyǒu
只有
xiān
zǒu
le
  

We had no choice but to go first for he did not come after a long time.