Contents
How do you comment on a database?
Comments
- Begin the comment with a slash and an asterisk (/*). Proceed with the text of the comment. This text can span multiple lines. End the comment with an asterisk and a slash (*/).
- Begin the comment with — (two hyphens). Proceed with the text of the comment. This text cannot extend to a new line.
How do I comment in SQL?
MySQL Server supports three comment styles: From a # character to the end of the line. From a — sequence to the end of the line. In MySQL, the — (double-dash) comment style requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on).
How do I comment in SQL code?
To comment out or uncomment SQL code in the SQL and XQuery editor:
- Select the SQL code that you want to comment out or uncomment. For a single line, click anywhere in the line of code. For multiple lines, drag the pointer through the lines of code.
- Right-click the selected SQL code, and then select Toggle Comment.
How to store comments and likes in database?
The question is, how to properly, efficiently and elastically design the database, so that it can store comments for different tables, likes for different tables and tags for them. Some design pattern as answer will be best 😉
What do you need to know about database design?
Their design, or schema, is literally the blueprint for how all information is stored, updated, and accessed. However learning about databases is difficult. There are many long, complicated books on database theory, but few simple explanations for beginners. This is a tutorial on database design for beginners.
How to design comments and replies in MySQL?
Now I’ve got to design replies to comments. The replies is just one level, so users can only reply to comments, not to replies. The tree structure is only 1 level deep. My first idea was to use the same comment table for both comments and replies. I added a new column though: Replies have parentcommentid set to the parent comment they belong.
How to insert comments in MySQL database schema?
In the table there are two parent comments and two replies to the second parent comment. No replies to first parent comment. This approach is obviously slightly more overhead on inserts as you have to look up the ordering value of the last comment on an “id” but querying the data is simple.