我有一个名为songInPlaylist的表,我想添加一个不存在的新行,该表链接到其他两个表song和playlist。 songInPlaylist包含以下字段:songId,playlistId(所有这些字段都是其他两个表的外键)。
我开始编写这段代码
insert into songinplaylist
(select songid, playlistid
from songinplaylist
where songid = 1 and playlistid = 10)
我要添加新行(songid -> 1, playlistid -> 10)
当表格中不存在该行时。
答案 0 :(得分:1)
这是标准的ANSI插入语法。看看
insert into songinplaylist
(songid, playlistid) values (1,10);
答案 1 :(得分:0)
使用// create object and add to scene
const sphere = new THREE.Mesh( geometry, material );
const origin = new THREE.Vector3(0, 0, 75);
sphere.position.x = 0;
sphere.position.z = 0;
sphere.lookAt(origin);
scene.add( sphere );
window.addEventListener("mousemove", onmousemove, false);
var plane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0);
var raycaster = new THREE.Raycaster();
var mouse = new THREE.Vector2();
var intersectPoint = new THREE.Vector3();
function onmousemove(event) {
var startRotation = sphere.quaternion.clone();
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
raycaster.setFromCamera(mouse, camera);
raycaster.ray.intersectPlane(plane, intersectPoint);
intersectPoint.z = 75; // so that the object is still always facing the camera which has a position.z of 75 too
sphere.lookAt(intersectPoint);
var endRotation = sphere.quaternion.clone();
sphere.quaternion.copy( startRotation );
createjs.Tween.get(sphere.quaternion).to(endRotation, 1000, createjs.Ease.getPowOut(2.2));
marker.position.copy(intersectPoint);
}
检查该行是否已经存在:
WHERE