mysql 常用sql语句
1、增添字段
DROP PROCEDURE
IF EXISTS add_col_comment_pharmacysaleitem;
CREATE PROCEDURE add_col_comment_pharmacysaleitem ()
BEGIN
IF NOT EXISTS (
SELECT
column_name
FROM
information_schema. COLUMNS
WHERE
table_schema = DATABASE ()
AND column_name = 'Comment'
AND TABLE_NAME = 'pharmacysaleitem'
) THEN
ALTER TABLE pharmacysaleitem ADD COMMENT VARCHAR (255) NULL;
END
IF;
END;
CALL add_col_comment_pharmacysaleitem ()